Toogle Button

outandabout24

Registered User.
Local time
Today, 11:17
Joined
Dec 29, 2009
Messages
22
Quick question,
I have a form that has a text box and a toogle button... How do I make the current date appear in the text box when I click the toogle button? I've tried so many differant options and nothing has worked. Obviously the date would be recorded in a table as well. Thanks
 
In the AfterUpdate event of the toggle button you can use:

Code:
If Me.YourToggleButtonNameHere Then
   Me.YourDateTextBoxNameHere = Date()
Else
  Me.YourDateTextBoxNameHere = Null
End If
 
Thanks that worked but I have one problem. Is there any reason why I would get a date of 12/29/1899 instead of 2009?
 
I've tried using the now function but I don't want the time with it..

Try setting the properties for the Text Box to display a Short Date, or maybe you can set the Text Box Source to be something like this:

=Format(Now(),"Short Date")
 
Try setting the properties for the Text Box to display a Short Date, or maybe you can set the Text Box Source to be something like this:

=Format(Now(),"Short Date")
WHY??????

Just use DATE()

it ONLY gives the date, no time.
 
If I'm a betting man, the OP has a field named Date. If so, the workaround would be:

Me.YourDateTextBoxNameHere = VBA.Date
 
Not sure boblarson why using just "date" would give me 12/29/1899 but it did.. so I used MSAccess option and it worked... I also used another code that someone suggested.. Here I just used the text box called currentdate2. This stamped the date as 12/29/2009 either way it worked!

Private Sub Toggle3_AfterUpdate()
If Me.Toggle3 Then
Me.currentdate2 = date
Else
Me.currentdate2 = Null
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom