Toggle Buttons

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have made a database that requeirs time be put in, on the from I'm tring to
put a toggle button on it that enters the current time in the time box, I've
figured how to put the control source in but when I set the default value to
enter the current time =Now() it puts 12/12/1899 0:00. What do I need to do
to get it to give me the current time.
 
mustangric2001 said:
I have made a database that requeirs time be put in, on the from I'm tring
to
put a toggle button on it that enters the current time in the time box,
I've
figured how to put the control source in but when I set the default value
to
enter the current time =Now() it puts 12/12/1899 0:00. What do I need to
do
to get it to give me the current time.

You're going to kick yourself :-)

=Time()
 
It's still doing the same thing, I must be doing something else wrong. In the
table I have the data type as Date/Time and formatted as short time. Is there
something else i'm supoost to be doing?
 
mustangric2001 said:
It's still doing the same thing, I must be doing something else wrong. In
the
table I have the data type as Date/Time and formatted as short time. Is
there
something else i'm supoost to be doing?

Where exactly are you entering the expression? In the DefaultValue property
of the textbox?
 
mustangric2001 said:
On the form I right click on the toggle button and go to properties then
on
the data section I go to default value

That's your problem right there. The DefaultValue for a button cannot be a
date or time value. That is meaningless as far as the button is concerned.
Plus you aren't affecting the textbox value at all. What you need to do (if
I understand you correctly) is feed the current time to the textbox when the
button is clicked. To do this, put the following code into the OnClick event
procedure for the button:

Me!TextboxName.Value = Time

Substitute TextboxName with your textbox control's name.
 
Sorry to be such a pain, when I put that code in it said that it could not
find the macro 'Me!Time'.
 
mustangric2001 said:
Sorry to be such a pain, when I put that code in it said that it could not
find the macro 'Me!Time'.

Ah. If 'Time' is indeed the name of your textbox, change its name to (say)
txtTime. You are using a reserved word and Access is getting muddled up.
 
I didn't think was going to be this hard, everything I try it give me the
same error messege. that it could not find the macro Me!time or Me!txtTime.
All I want is it to put the current time in time box when you click the
button. Please tell me what I am doing wrong. I will start from scratch if it
will be easier.
 
mustangric2001 said:
I didn't think was going to be this hard, everything I try it give me the
same error messege. that it could not find the macro Me!time or
Me!txtTime.

Don't worry. Experience is what you get when you don't get what you want.
All I want is it to put the current time in time box when you click the
button. Please tell me what I am doing wrong. I will start from scratch if
it
will be easier.

Ok, assuming your textbox is now called txtTime, do the following:

Right click on your button and open the properties sheet.
Find the OnClick event property and replace whatever it contains with:

[Event Procedure]

Click the build button which takes you to the code window and creates an
empty OnClick procedure for you.
Inside the body of the procedure, type in the code:

Me!txtTime.Value = Time

If that doesn't do it then something else is interfering somehow (sorry to
be so vague, but it could be all sorts of things)
 
Thank you very much, It finely worked.

Stuart McCall said:
mustangric2001 said:
I didn't think was going to be this hard, everything I try it give me the
same error messege. that it could not find the macro Me!time or
Me!txtTime.

Don't worry. Experience is what you get when you don't get what you want.
All I want is it to put the current time in time box when you click the
button. Please tell me what I am doing wrong. I will start from scratch if
it
will be easier.

Ok, assuming your textbox is now called txtTime, do the following:

Right click on your button and open the properties sheet.
Find the OnClick event property and replace whatever it contains with:

[Event Procedure]

Click the build button which takes you to the code window and creates an
empty OnClick procedure for you.
Inside the body of the procedure, type in the code:

Me!txtTime.Value = Time

If that doesn't do it then something else is interfering somehow (sorry to
be so vague, but it could be all sorts of things)
 
Back
Top