Command Buttons on a form

  • Thread starter Thread starter James
  • Start date Start date
J

James

Ok I have these 3 command buttons on this form and well I
have this as the code that runs them:

me.fldappfieldnamehere = now()

I have done that on two cmd buttons but when I come to do
it to the third it does not appear in the

Me.

Drop down box....

How can I get VB to put it in there so I can run a valid
command?

Many Thanks

James
 
The button has been renamed and I am in the On Click
command to run this specific piece of code. Yet the
problem lies where VB is just not seeing it as an object
of the form. I have tried Dim fldappfieldnamehere As
Object and it just dosent seem to do anything...

Any Ideas?

Many Thanks

James
 
James,

You should have 3 'Click Event' Procedures. They will look something like:

Private Sub cmdMyButton_Click()

' Say hello to the user
MsgBox "Hello!"

End Sub

In the above, when the button (named cmdMyButton) is clicked, a message box
appears saying "Hello!".
From your question:

Me.fldappfieldnamehere = Now()

I am assuming you are placing the date and time into a text box on your form
(the textbox is named fldappfieldnamehere).

One thing to check is to go into the design view for the form. Right click
on the command button and goto properties. In the On Click property (found
under the Event tab), you must have [Event Procedure] in there for Access to
run the On Click code.

HTH,

Neil.
 
hmm...

what is fldappnameoffieldhere? A text box, command button, another function?
what do you mean when you say "I need the commandhere to appear"?

Answer to your object question:
If there was a command button on your form named cmdMyButton you would get
to it as follows:

Dim cmdTemp As Object
Set cmdTemp = Me.cmdMyButton.Object
' Disable the button
cmdTemp.Enabled = False
' Clean up
Set cmdTemp = Nothing

Note that you still have to get the control from the form. I dont know if
you are aware but Me is a pointer to the form (or object) in which your code
is found. If you have code in a form (say frmMain) and you want to get to a
control on another form (frmSecondForm) you have to use

Forms!frmSecondForm!ControlName

Without knowing what type of object fldappnameoffieldhere is and where it is
located, i cant provide an accurate answer that will help you.

Neil.

James said:
I know this but How do I create the fldappnameoffieldhere
as an object because when I do the me.commandhere

There is no object that I can use so hence it will not
work.

I need the commandhere to appear as an object that VB can
use how do I achieve this?

Sorry if it sounds nasty its just I am sick of this damn
problem.....

James
-----Original Message-----
James,

You should have 3 'Click Event' Procedures. They will look something like:

Private Sub cmdMyButton_Click()

' Say hello to the user
MsgBox "Hello!"

End Sub

In the above, when the button (named cmdMyButton) is clicked, a message box
appears saying "Hello!".
From your question:

Me.fldappfieldnamehere = Now()

I am assuming you are placing the date and time into a text box on your form
(the textbox is named fldappfieldnamehere).

One thing to check is to go into the design view for the form. Right click
on the command button and goto properties. In the On Click property (found
under the Event tab), you must have [Event Procedure] in there for Access to
run the On Click code.

HTH,

Neil.

James said:
The button has been renamed and I am in the On Click
command to run this specific piece of code. Yet the
problem lies where VB is just not seeing it as an object
of the form. I have tried Dim fldappfieldnamehere As
Object and it just dosent seem to do anything...

Any Ideas?

Many Thanks

James

-----Original Message-----
James,

Double check that you have renamed the button to what you
want. It may still
be there as the default Command....

HTH,

Neil.

Ok I have these 3 command buttons on this form and well
I
have this as the code that runs them:

me.fldappfieldnamehere = now()

I have done that on two cmd buttons but when I come to
do
it to the third it does not appear in the

Me.

Drop down box....

How can I get VB to put it in there so I can run a valid
command?

Many Thanks

James


.


.
 
Ah Right, You would the ControlSource for a Text Box as a String Type
variable. e.g.

Dim strMyTextFieldControlSource As String
' Assign the controls source
strMyTextFieldControlSource = Me.txtMyTextField.ControlSource
' Display the control source
MsgBox strMyTextFieldControlSource

The above declares a variable named strMyTextFieldControlSource as a String
(text). It then assigns whatever is in the ControlSource of the text box
(named txtMyTextField) to the string variable. The next line displays what
is contained in the string variable in a message box.

It is still unclear as to what you are doing...
....what are the 3 command buttons supposed to do?
....Writing Me.fldappfieldnamehere = Now() will cause an error if there is no
textbox (or other object) named fldappfieldnamehere on your form.
....You are putting the date and time into a textbox (or other object) named
fldappfieldnamehere on your form - nothing to do with any ControlSource?

Do you have any code that you can post (and a description of what it's
supposed to do) - maybe able to point you in the right direction then.

Neil.

James said:
Its a control source from a text bo if thats any help to
you.

Many Thanks With your help on this... While waiting for
another reply of you (if you have one) I will give your
coding a try...

Thanks Again

James
-----Original Message-----
hmm...

what is fldappnameoffieldhere? A text box, command button, another function?
what do you mean when you say "I need the commandhere to appear"?

Answer to your object question:
If there was a command button on your form named cmdMyButton you would get
to it as follows:

Dim cmdTemp As Object
Set cmdTemp = Me.cmdMyButton.Object
' Disable the button
cmdTemp.Enabled = False
' Clean up
Set cmdTemp = Nothing

Note that you still have to get the control from the form. I dont know if
you are aware but Me is a pointer to the form (or object) in which your code
is found. If you have code in a form (say frmMain) and you want to get to a
control on another form (frmSecondForm) you have to use

Forms!frmSecondForm!ControlName

Without knowing what type of object fldappnameoffieldhere is and where it is
located, i cant provide an accurate answer that will help you.

Neil.

James said:
I know this but How do I create the fldappnameoffieldhere
as an object because when I do the me.commandhere

There is no object that I can use so hence it will not
work.

I need the commandhere to appear as an object that VB can
use how do I achieve this?

Sorry if it sounds nasty its just I am sick of this damn
problem.....

James

-----Original Message-----
James,

You should have 3 'Click Event' Procedures. They will
look something like:

Private Sub cmdMyButton_Click()

' Say hello to the user
MsgBox "Hello!"

End Sub

In the above, when the button (named cmdMyButton) is
clicked, a message box
appears saying "Hello!".
From your question:

Me.fldappfieldnamehere = Now()

I am assuming you are placing the date and time into a
text box on your form
(the textbox is named fldappfieldnamehere).

One thing to check is to go into the design view for the
form. Right click
on the command button and goto properties. In the On
Click property (found
under the Event tab), you must have [Event Procedure] in
there for Access to
run the On Click code.

HTH,

Neil.

The button has been renamed and I am in the On Click
command to run this specific piece of code. Yet the
problem lies where VB is just not seeing it as an object
of the form. I have tried Dim fldappfieldnamehere As
Object and it just dosent seem to do anything...

Any Ideas?

Many Thanks

James

-----Original Message-----
James,

Double check that you have renamed the button to what
you
want. It may still
be there as the default Command....

HTH,

Neil.

Ok I have these 3 command buttons on this form and
well
I
have this as the code that runs them:

me.fldappfieldnamehere = now()

I have done that on two cmd buttons but when I come
to
do
it to the third it does not appear in the

Me.

Drop down box....

How can I get VB to put it in there so I can run a
valid
command?

Many Thanks

James


.



.


.
 
Ok then here is the code of the one command button that
works...

Private Sub cmdToday2_Click()
Me.fldAppDecisionDate = Now()
End Sub

Now then I have tried this obviously changing it slightly
but everything is set-up in the same way its just that the
text box has one name and within the design of the form it
has teh control source name...

So any ideas?

Thanks Again

James
-----Original Message-----
Ah Right, You would the ControlSource for a Text Box as a String Type
variable. e.g.

Dim strMyTextFieldControlSource As String
' Assign the controls source
strMyTextFieldControlSource = Me.txtMyTextField.ControlSource
' Display the control source
MsgBox strMyTextFieldControlSource

The above declares a variable named
strMyTextFieldControlSource as a String
(text). It then assigns whatever is in the ControlSource of the text box
(named txtMyTextField) to the string variable. The next line displays what
is contained in the string variable in a message box.

It is still unclear as to what you are doing...
....what are the 3 command buttons supposed to do?
....Writing Me.fldappfieldnamehere = Now() will cause an error if there is no
textbox (or other object) named fldappfieldnamehere on your form.
....You are putting the date and time into a textbox (or other object) named
fldappfieldnamehere on your form - nothing to do with any ControlSource?

Do you have any code that you can post (and a description of what it's
supposed to do) - maybe able to point you in the right direction then.

Neil.

James said:
Its a control source from a text bo if thats any help to
you.

Many Thanks With your help on this... While waiting for
another reply of you (if you have one) I will give your
coding a try...

Thanks Again

James
-----Original Message-----
hmm...

what is fldappnameoffieldhere? A text box, command button, another function?
what do you mean when you say "I need the commandhere
to
appear"?
Answer to your object question:
If there was a command button on your form named cmdMyButton you would get
to it as follows:

Dim cmdTemp As Object
Set cmdTemp = Me.cmdMyButton.Object
' Disable the button
cmdTemp.Enabled = False
' Clean up
Set cmdTemp = Nothing

Note that you still have to get the control from the form. I dont know if
you are aware but Me is a pointer to the form (or
object)
in which your code
is found. If you have code in a form (say frmMain) and you want to get to a
control on another form (frmSecondForm) you have to use

Forms!frmSecondForm!ControlName

Without knowing what type of object
fldappnameoffieldhere
is and where it is
located, i cant provide an accurate answer that will
help
you.
Neil.

I know this but How do I create the fldappnameoffieldhere
as an object because when I do the me.commandhere

There is no object that I can use so hence it will not
work.

I need the commandhere to appear as an object that VB can
use how do I achieve this?

Sorry if it sounds nasty its just I am sick of this damn
problem.....

James

-----Original Message-----
James,

You should have 3 'Click Event' Procedures. They will
look something like:

Private Sub cmdMyButton_Click()

' Say hello to the user
MsgBox "Hello!"

End Sub

In the above, when the button (named cmdMyButton) is
clicked, a message box
appears saying "Hello!".
From your question:

Me.fldappfieldnamehere = Now()

I am assuming you are placing the date and time into a
text box on your form
(the textbox is named fldappfieldnamehere).

One thing to check is to go into the design view for the
form. Right click
on the command button and goto properties. In the On
Click property (found
under the Event tab), you must have [Event
Procedure]
in
there for Access to
run the On Click code.

HTH,

Neil.

The button has been renamed and I am in the On Click
command to run this specific piece of code. Yet the
problem lies where VB is just not seeing it as an object
of the form. I have tried Dim fldappfieldnamehere As
Object and it just dosent seem to do anything...

Any Ideas?

Many Thanks

James

-----Original Message-----
James,

Double check that you have renamed the button to what
you
want. It may still
be there as the default Command....

HTH,

Neil.

Ok I have these 3 command buttons on this form and
well
I
have this as the code that runs them:

me.fldappfieldnamehere = now()

I have done that on two cmd buttons but when I come
to
do
it to the third it does not appear in the

Me.

Drop down box....

How can I get VB to put it in there so I can run a
valid
command?

Many Thanks

James


.



.



.


.
 
So when the user clicks on cmdToday2, you make the textbox on your form
(named fldAppDecisionDate) to be the current date and time. What is the
button that you are having problems with, and what are you trying to do when
the user clicks on this button. Also, you will always reference a control on
a form by its name, note that the control source (found in data) and the
name (found in other) are the same by default.

We are going to solve this!! :-)

Neil.

James said:
Ok then here is the code of the one command button that
works...

Private Sub cmdToday2_Click()
Me.fldAppDecisionDate = Now()
End Sub

Now then I have tried this obviously changing it slightly
but everything is set-up in the same way its just that the
text box has one name and within the design of the form it
has teh control source name...

So any ideas?

Thanks Again

James
-----Original Message-----
Ah Right, You would the ControlSource for a Text Box as a String Type
variable. e.g.

Dim strMyTextFieldControlSource As String
' Assign the controls source
strMyTextFieldControlSource = Me.txtMyTextField.ControlSource
' Display the control source
MsgBox strMyTextFieldControlSource

The above declares a variable named
strMyTextFieldControlSource as a String
(text). It then assigns whatever is in the ControlSource of the text box
(named txtMyTextField) to the string variable. The next line displays what
is contained in the string variable in a message box.

It is still unclear as to what you are doing...
....what are the 3 command buttons supposed to do?
....Writing Me.fldappfieldnamehere = Now() will cause an error if there is no
textbox (or other object) named fldappfieldnamehere on your form.
....You are putting the date and time into a textbox (or other object) named
fldappfieldnamehere on your form - nothing to do with any ControlSource?

Do you have any code that you can post (and a description of what it's
supposed to do) - maybe able to point you in the right direction then.

Neil.

James said:
Its a control source from a text bo if thats any help to
you.

Many Thanks With your help on this... While waiting for
another reply of you (if you have one) I will give your
coding a try...

Thanks Again

James

-----Original Message-----
hmm...

what is fldappnameoffieldhere? A text box, command
button, another function?
what do you mean when you say "I need the commandhere to
appear"?

Answer to your object question:
If there was a command button on your form named
cmdMyButton you would get
to it as follows:

Dim cmdTemp As Object
Set cmdTemp = Me.cmdMyButton.Object
' Disable the button
cmdTemp.Enabled = False
' Clean up
Set cmdTemp = Nothing

Note that you still have to get the control from the
form. I dont know if
you are aware but Me is a pointer to the form (or object)
in which your code
is found. If you have code in a form (say frmMain) and
you want to get to a
control on another form (frmSecondForm) you have to use

Forms!frmSecondForm!ControlName

Without knowing what type of object fldappnameoffieldhere
is and where it is
located, i cant provide an accurate answer that will help
you.

Neil.

I know this but How do I create the
fldappnameoffieldhere
as an object because when I do the me.commandhere

There is no object that I can use so hence it will not
work.

I need the commandhere to appear as an object that VB
can
use how do I achieve this?

Sorry if it sounds nasty its just I am sick of this damn
problem.....

James

-----Original Message-----
James,

You should have 3 'Click Event' Procedures. They will
look something like:

Private Sub cmdMyButton_Click()

' Say hello to the user
MsgBox "Hello!"

End Sub

In the above, when the button (named cmdMyButton) is
clicked, a message box
appears saying "Hello!".
From your question:

Me.fldappfieldnamehere = Now()

I am assuming you are placing the date and time into a
text box on your form
(the textbox is named fldappfieldnamehere).

One thing to check is to go into the design view for
the
form. Right click
on the command button and goto properties. In the On
Click property (found
under the Event tab), you must have [Event Procedure]
in
there for Access to
run the On Click code.

HTH,

Neil.

The button has been renamed and I am in the On Click
command to run this specific piece of code. Yet the
problem lies where VB is just not seeing it as an
object
of the form. I have tried Dim fldappfieldnamehere As
Object and it just dosent seem to do anything...

Any Ideas?

Many Thanks

James

-----Original Message-----
James,

Double check that you have renamed the button to
what
you
want. It may still
be there as the default Command....

HTH,

Neil.

Ok I have these 3 command buttons on this form and
well
I
have this as the code that runs them:

me.fldappfieldnamehere = now()

I have done that on two cmd buttons but when I
come
to
do
it to the third it does not appear in the

Me.

Drop down box....

How can I get VB to put it in there so I can run a
valid
command?

Many Thanks

James


.



.



.


.
 
This is where you lose me... is it another text box on the form?
If so, all I can suggest is to remove the text box and try placing another
one on there (and check the name again).
One last thing, you havnt got a sub form on this form have you?

Neil.

James said:
Cheers for your patience with this because its driving me
up the wall....

I would like it to do the same thing but rather than it be
nice and give me the option I want (Like in teh example
below I have the option of fldAppDecisionDate) I would
like just a diffrent option but I dont get it as an object
within the database as far as Access is concerned...

Why Me!!!! :-)

James

-----Original Message-----
So when the user clicks on cmdToday2, you make the textbox on your form
(named fldAppDecisionDate) to be the current date and time. What is the
button that you are having problems with, and what are you trying to do when
the user clicks on this button. Also, you will always reference a control on
a form by its name, note that the control source (found in data) and the
name (found in other) are the same by default.

We are going to solve this!! :-)

Neil.

James said:
Ok then here is the code of the one command button that
works...

Private Sub cmdToday2_Click()
Me.fldAppDecisionDate = Now()
End Sub

Now then I have tried this obviously changing it slightly
but everything is set-up in the same way its just that the
text box has one name and within the design of the form it
has teh control source name...

So any ideas?

Thanks Again

James

-----Original Message-----
Ah Right, You would the ControlSource for a Text Box as a
String Type
variable. e.g.

Dim strMyTextFieldControlSource As String
' Assign the controls source
strMyTextFieldControlSource =
Me.txtMyTextField.ControlSource
' Display the control source
MsgBox strMyTextFieldControlSource

The above declares a variable named
strMyTextFieldControlSource as a String
(text). It then assigns whatever is in the ControlSource
of the text box
(named txtMyTextField) to the string variable. The next
line displays what
is contained in the string variable in a message box.

It is still unclear as to what you are doing...
....what are the 3 command buttons supposed to do?
....Writing Me.fldappfieldnamehere = Now() will cause an
error if there is no
textbox (or other object) named fldappfieldnamehere on
your form.
....You are putting the date and time into a textbox (or
other object) named
fldappfieldnamehere on your form - nothing to do with any
ControlSource?

Do you have any code that you can post (and a description
of what it's
supposed to do) - maybe able to point you in the right
direction then.

Neil.

Its a control source from a text bo if thats any help to
you.

Many Thanks With your help on this... While waiting for
another reply of you (if you have one) I will give your
coding a try...

Thanks Again

James

-----Original Message-----
hmm...

what is fldappnameoffieldhere? A text box, command
button, another function?
what do you mean when you say "I need the commandhere
to
appear"?

Answer to your object question:
If there was a command button on your form named
cmdMyButton you would get
to it as follows:

Dim cmdTemp As Object
Set cmdTemp = Me.cmdMyButton.Object
' Disable the button
cmdTemp.Enabled = False
' Clean up
Set cmdTemp = Nothing

Note that you still have to get the control from the
form. I dont know if
you are aware but Me is a pointer to the form (or
object)
in which your code
is found. If you have code in a form (say frmMain) and
you want to get to a
control on another form (frmSecondForm) you have to use

Forms!frmSecondForm!ControlName

Without knowing what type of object
fldappnameoffieldhere
is and where it is
located, i cant provide an accurate answer that will
help
you.

Neil.

I know this but How do I create the
fldappnameoffieldhere
as an object because when I do the me.commandhere

There is no object that I can use so hence it will
not
work.

I need the commandhere to appear as an object that VB
can
use how do I achieve this?

Sorry if it sounds nasty its just I am sick of this
damn
problem.....

James

-----Original Message-----
James,

You should have 3 'Click Event' Procedures. They
will
look something like:

Private Sub cmdMyButton_Click()

' Say hello to the user
MsgBox "Hello!"

End Sub

In the above, when the button (named cmdMyButton) is
clicked, a message box
appears saying "Hello!".
From your question:

Me.fldappfieldnamehere = Now()

I am assuming you are placing the date and time
into a
text box on your form
(the textbox is named fldappfieldnamehere).

One thing to check is to go into the design view for
the
form. Right click
on the command button and goto properties. In the On
Click property (found
under the Event tab), you must have [Event
Procedure]
in
there for Access to
run the On Click code.

HTH,

Neil.

The button has been renamed and I am in the On
Click
command to run this specific piece of code. Yet
the
problem lies where VB is just not seeing it as an
object
of the form. I have tried Dim fldappfieldnamehere
As
Object and it just dosent seem to do anything...

Any Ideas?

Many Thanks

James

-----Original Message-----
James,

Double check that you have renamed the button to
what
you
want. It may still
be there as the default Command....

HTH,

Neil.

Ok I have these 3 command buttons on this form
and
well
I
have this as the code that runs them:

me.fldappfieldnamehere = now()

I have done that on two cmd buttons but when I
come
to
do
it to the third it does not appear in the

Me.

Drop down box....

How can I get VB to put it in there so I can
run a
valid
command?

Many Thanks

James


.



.



.



.


.
 
Tell you what would you have a problem with me E-Mailing
the database to you?

If I let you know in the mail what your looking at? Would
that then be easier?

Many Thanks

James

-----Original Message-----
This is where you lose me... is it another text box on the form?
If so, all I can suggest is to remove the text box and try placing another
one on there (and check the name again).
One last thing, you havnt got a sub form on this form have you?

Neil.

James said:
Cheers for your patience with this because its driving me
up the wall....

I would like it to do the same thing but rather than it be
nice and give me the option I want (Like in teh example
below I have the option of fldAppDecisionDate) I would
like just a diffrent option but I dont get it as an object
within the database as far as Access is concerned...

Why Me!!!! :-)

James

-----Original Message-----
So when the user clicks on cmdToday2, you make the textbox on your form
(named fldAppDecisionDate) to be the current date and time. What is the
button that you are having problems with, and what are you trying to do when
the user clicks on this button. Also, you will always reference a control on
a form by its name, note that the control source (found in data) and the
name (found in other) are the same by default.

We are going to solve this!! :-)

Neil.

Ok then here is the code of the one command button that
works...

Private Sub cmdToday2_Click()
Me.fldAppDecisionDate = Now()
End Sub

Now then I have tried this obviously changing it slightly
but everything is set-up in the same way its just
that
the
text box has one name and within the design of the
form
it
has teh control source name...

So any ideas?

Thanks Again

James

-----Original Message-----
Ah Right, You would the ControlSource for a Text Box as a
String Type
variable. e.g.

Dim strMyTextFieldControlSource As String
' Assign the controls source
strMyTextFieldControlSource =
Me.txtMyTextField.ControlSource
' Display the control source
MsgBox strMyTextFieldControlSource

The above declares a variable named
strMyTextFieldControlSource as a String
(text). It then assigns whatever is in the ControlSource
of the text box
(named txtMyTextField) to the string variable. The next
line displays what
is contained in the string variable in a message box.

It is still unclear as to what you are doing...
....what are the 3 command buttons supposed to do?
....Writing Me.fldappfieldnamehere = Now() will
cause
an
error if there is no
textbox (or other object) named fldappfieldnamehere on
your form.
....You are putting the date and time into a textbox (or
other object) named
fldappfieldnamehere on your form - nothing to do
with
any
ControlSource?

Do you have any code that you can post (and a description
of what it's
supposed to do) - maybe able to point you in the right
direction then.

Neil.

Its a control source from a text bo if thats any help to
you.

Many Thanks With your help on this... While
waiting
for
another reply of you (if you have one) I will give your
coding a try...

Thanks Again

James

-----Original Message-----
hmm...

what is fldappnameoffieldhere? A text box, command
button, another function?
what do you mean when you say "I need the commandhere
to
appear"?

Answer to your object question:
If there was a command button on your form named
cmdMyButton you would get
to it as follows:

Dim cmdTemp As Object
Set cmdTemp = Me.cmdMyButton.Object
' Disable the button
cmdTemp.Enabled = False
' Clean up
Set cmdTemp = Nothing

Note that you still have to get the control from the
form. I dont know if
you are aware but Me is a pointer to the form (or
object)
in which your code
is found. If you have code in a form (say
frmMain)
and
you want to get to a
control on another form (frmSecondForm) you have
to
use
Forms!frmSecondForm!ControlName

Without knowing what type of object
fldappnameoffieldhere
is and where it is
located, i cant provide an accurate answer that will
help
you.

Neil.

I know this but How do I create the
fldappnameoffieldhere
as an object because when I do the me.commandhere

There is no object that I can use so hence it will
not
work.

I need the commandhere to appear as an object that VB
can
use how do I achieve this?

Sorry if it sounds nasty its just I am sick of this
damn
problem.....

James

-----Original Message-----
James,

You should have 3 'Click Event' Procedures. They
will
look something like:

Private Sub cmdMyButton_Click()

' Say hello to the user
MsgBox "Hello!"

End Sub

In the above, when the button (named cmdMyButton) is
clicked, a message box
appears saying "Hello!".
From your question:

Me.fldappfieldnamehere = Now()

I am assuming you are placing the date and time
into a
text box on your form
(the textbox is named fldappfieldnamehere).

One thing to check is to go into the design
view
for
the
form. Right click
on the command button and goto properties. In the On
Click property (found
under the Event tab), you must have [Event
Procedure]
in
there for Access to
run the On Click code.

HTH,

Neil.

The button has been renamed and I am in the On
Click
command to run this specific piece of code. Yet
the
problem lies where VB is just not seeing it
as
an
object
of the form. I have tried Dim fldappfieldnamehere
As
Object and it just dosent seem to do anything...

Any Ideas?

Many Thanks

James

-----Original Message-----
James,

Double check that you have renamed the
button
to
what
you
want. It may still
be there as the default Command....

HTH,

Neil.

[email protected]...
Ok I have these 3 command buttons on this form
and
well
I
have this as the code that runs them:

me.fldappfieldnamehere = now()

I have done that on two cmd buttons but when I
come
to
do
it to the third it does not appear in the

Me.

Drop down box....

How can I get VB to put it in there so I can
run a
valid
command?

Many Thanks

James


.



.



.



.



.


.
 
Yes! email it to (e-mail address removed)

Neil.

James said:
Tell you what would you have a problem with me E-Mailing
the database to you?

If I let you know in the mail what your looking at? Would
that then be easier?

Many Thanks

James

-----Original Message-----
This is where you lose me... is it another text box on the form?
If so, all I can suggest is to remove the text box and try placing another
one on there (and check the name again).
One last thing, you havnt got a sub form on this form have you?

Neil.

James said:
Cheers for your patience with this because its driving me
up the wall....

I would like it to do the same thing but rather than it be
nice and give me the option I want (Like in teh example
below I have the option of fldAppDecisionDate) I would
like just a diffrent option but I dont get it as an object
within the database as far as Access is concerned...

Why Me!!!! :-)

James


-----Original Message-----
So when the user clicks on cmdToday2, you make the
textbox on your form
(named fldAppDecisionDate) to be the current date and
time. What is the
button that you are having problems with, and what are
you trying to do when
the user clicks on this button. Also, you will always
reference a control on
a form by its name, note that the control source (found
in data) and the
name (found in other) are the same by default.

We are going to solve this!! :-)

Neil.

Ok then here is the code of the one command button that
works...

Private Sub cmdToday2_Click()
Me.fldAppDecisionDate = Now()
End Sub

Now then I have tried this obviously changing it
slightly
but everything is set-up in the same way its just that
the
text box has one name and within the design of the form
it
has teh control source name...

So any ideas?

Thanks Again

James

-----Original Message-----
Ah Right, You would the ControlSource for a Text Box
as a
String Type
variable. e.g.

Dim strMyTextFieldControlSource As String
' Assign the controls source
strMyTextFieldControlSource =
Me.txtMyTextField.ControlSource
' Display the control source
MsgBox strMyTextFieldControlSource

The above declares a variable named
strMyTextFieldControlSource as a String
(text). It then assigns whatever is in the
ControlSource
of the text box
(named txtMyTextField) to the string variable. The next
line displays what
is contained in the string variable in a message box.

It is still unclear as to what you are doing...
....what are the 3 command buttons supposed to do?
....Writing Me.fldappfieldnamehere = Now() will cause
an
error if there is no
textbox (or other object) named fldappfieldnamehere on
your form.
....You are putting the date and time into a textbox
(or
other object) named
fldappfieldnamehere on your form - nothing to do with
any
ControlSource?

Do you have any code that you can post (and a
description
of what it's
supposed to do) - maybe able to point you in the right
direction then.

Neil.

Its a control source from a text bo if thats any
help to
you.

Many Thanks With your help on this... While waiting
for
another reply of you (if you have one) I will give
your
coding a try...

Thanks Again

James

-----Original Message-----
hmm...

what is fldappnameoffieldhere? A text box, command
button, another function?
what do you mean when you say "I need the
commandhere
to
appear"?

Answer to your object question:
If there was a command button on your form named
cmdMyButton you would get
to it as follows:

Dim cmdTemp As Object
Set cmdTemp = Me.cmdMyButton.Object
' Disable the button
cmdTemp.Enabled = False
' Clean up
Set cmdTemp = Nothing

Note that you still have to get the control from the
form. I dont know if
you are aware but Me is a pointer to the form (or
object)
in which your code
is found. If you have code in a form (say frmMain)
and
you want to get to a
control on another form (frmSecondForm) you have to
use

Forms!frmSecondForm!ControlName

Without knowing what type of object
fldappnameoffieldhere
is and where it is
located, i cant provide an accurate answer that will
help
you.

Neil.

I know this but How do I create the
fldappnameoffieldhere
as an object because when I do the me.commandhere

There is no object that I can use so hence it will
not
work.

I need the commandhere to appear as an object
that VB
can
use how do I achieve this?

Sorry if it sounds nasty its just I am sick of
this
damn
problem.....

James

-----Original Message-----
James,

You should have 3 'Click Event' Procedures. They
will
look something like:

Private Sub cmdMyButton_Click()

' Say hello to the user
MsgBox "Hello!"

End Sub

In the above, when the button (named
cmdMyButton) is
clicked, a message box
appears saying "Hello!".
From your question:

Me.fldappfieldnamehere = Now()

I am assuming you are placing the date and time
into a
text box on your form
(the textbox is named fldappfieldnamehere).

One thing to check is to go into the design view
for
the
form. Right click
on the command button and goto properties. In
the On
Click property (found
under the Event tab), you must have [Event
Procedure]
in
there for Access to
run the On Click code.

HTH,

Neil.

The button has been renamed and I am in the On
Click
command to run this specific piece of code. Yet
the
problem lies where VB is just not seeing it as
an
object
of the form. I have tried Dim
fldappfieldnamehere
As
Object and it just dosent seem to do
anything...

Any Ideas?

Many Thanks

James

-----Original Message-----
James,

Double check that you have renamed the button
to
what
you
want. It may still
be there as the default Command....

HTH,

Neil.

message
[email protected]...
Ok I have these 3 command buttons on this
form
and
well
I
have this as the code that runs them:

me.fldappfieldnamehere = now()

I have done that on two cmd buttons but
when I
come
to
do
it to the third it does not appear in the

Me.

Drop down box....

How can I get VB to put it in there so I can
run a
valid
command?

Many Thanks

James


.



.



.



.



.


.
 
If you are using Access 2000 or later, try turning off the Name Autocorrect
feature (Tools: Options - General Tab) and see if that takes care of the
problems with the name of your objects not appearing when you are using the
AutoList members feature.
Yes! email it to (e-mail address removed)

Neil.

James said:
Tell you what would you have a problem with me E-Mailing
the database to you?

If I let you know in the mail what your looking at? Would
that then be easier?

Many Thanks

James

-----Original Message-----
This is where you lose me... is it another text box on the form?
If so, all I can suggest is to remove the text box and try placing another
one on there (and check the name again).
One last thing, you havnt got a sub form on this form have you?

Neil.

Cheers for your patience with this because its driving me
up the wall....

I would like it to do the same thing but rather than it be
nice and give me the option I want (Like in teh example
below I have the option of fldAppDecisionDate) I would
like just a diffrent option but I dont get it as an object
within the database as far as Access is concerned...

Why Me!!!! :-)

James


-----Original Message-----
So when the user clicks on cmdToday2, you make the
textbox on your form
(named fldAppDecisionDate) to be the current date and
time. What is the
button that you are having problems with, and what are
you trying to do when
the user clicks on this button. Also, you will always
reference a control on
a form by its name, note that the control source (found
in data) and the
name (found in other) are the same by default.

We are going to solve this!! :-)

Neil.

Ok then here is the code of the one command button that
works...

Private Sub cmdToday2_Click()
Me.fldAppDecisionDate = Now()
End Sub

Now then I have tried this obviously changing it
slightly
but everything is set-up in the same way its just that
the
text box has one name and within the design of the form
it
has teh control source name...

So any ideas?

Thanks Again

James

-----Original Message-----
Ah Right, You would the ControlSource for a Text Box
as a
String Type
variable. e.g.

Dim strMyTextFieldControlSource As String
' Assign the controls source
strMyTextFieldControlSource =
Me.txtMyTextField.ControlSource
' Display the control source
MsgBox strMyTextFieldControlSource

The above declares a variable named
strMyTextFieldControlSource as a String
(text). It then assigns whatever is in the
ControlSource
of the text box
(named txtMyTextField) to the string variable. The next
line displays what
is contained in the string variable in a message box.

It is still unclear as to what you are doing...
....what are the 3 command buttons supposed to do?
....Writing Me.fldappfieldnamehere = Now() will cause
an
error if there is no
textbox (or other object) named fldappfieldnamehere on
your form.
....You are putting the date and time into a textbox
(or
other object) named
fldappfieldnamehere on your form - nothing to do with
any
ControlSource?

Do you have any code that you can post (and a
description
of what it's
supposed to do) - maybe able to point you in the right
direction then.

Neil.

Its a control source from a text bo if thats any
help to
you.

Many Thanks With your help on this... While waiting
for
another reply of you (if you have one) I will give
your
coding a try...

Thanks Again

James

-----Original Message-----
hmm...

what is fldappnameoffieldhere? A text box, command
button, another function?
what do you mean when you say "I need the
commandhere
to
appear"?

Answer to your object question:
If there was a command button on your form named
cmdMyButton you would get
to it as follows:

Dim cmdTemp As Object
Set cmdTemp = Me.cmdMyButton.Object
' Disable the button
cmdTemp.Enabled = False
' Clean up
Set cmdTemp = Nothing

Note that you still have to get the control from the
form. I dont know if
you are aware but Me is a pointer to the form (or
object)
in which your code
is found. If you have code in a form (say frmMain)
and
you want to get to a
control on another form (frmSecondForm) you have to
use

Forms!frmSecondForm!ControlName

Without knowing what type of object
fldappnameoffieldhere
is and where it is
located, i cant provide an accurate answer that will
help
you.

Neil.

I know this but How do I create the
fldappnameoffieldhere
as an object because when I do the me.commandhere

There is no object that I can use so hence it will
not
work.

I need the commandhere to appear as an object
that VB
can
use how do I achieve this?

Sorry if it sounds nasty its just I am sick of
this
damn
problem.....

James

-----Original Message-----
James,

You should have 3 'Click Event' Procedures. They
will
look something like:

Private Sub cmdMyButton_Click()

' Say hello to the user
MsgBox "Hello!"

End Sub

In the above, when the button (named
cmdMyButton) is
clicked, a message box
appears saying "Hello!".
From your question:

Me.fldappfieldnamehere = Now()

I am assuming you are placing the date and time
into a
text box on your form
(the textbox is named fldappfieldnamehere).

One thing to check is to go into the design view
for
the
form. Right click
on the command button and goto properties. In
the On
Click property (found
under the Event tab), you must have [Event
Procedure]
in
there for Access to
run the On Click code.

HTH,

Neil.

The button has been renamed and I am in the On
Click
command to run this specific piece of code. Yet
the
problem lies where VB is just not seeing it as
an
object
of the form. I have tried Dim
fldappfieldnamehere
As
Object and it just dosent seem to do
anything...

Any Ideas?

Many Thanks

James

-----Original Message-----
James,

Double check that you have renamed the button
to
what
you
want. It may still
be there as the default Command....

HTH,

Neil.

message
[email protected]...
Ok I have these 3 command buttons on this
form
and
well
I
have this as the code that runs them:

me.fldappfieldnamehere = now()

I have done that on two cmd buttons but
when I
come
to
do
it to the third it does not appear in the

Me.

Drop down box....

How can I get VB to put it in there so I can
run a
valid
command?

Many Thanks

James


.



.



.



.



.



.
 
Back
Top