1899 Date

outandabout24

Registered User.
Local time
Today, 15:48
Joined
Dec 29, 2009
Messages
22
I am wondering how to get the current date 12/29/2009 without the time in a text box using a toggle button. I had someone else, Thanks boblarson, who helped me to get this code. When I use this code I get 12/29/1899.

Private Sub Toggle2_AfterUpdate()
If Me.Toggle2 Then
Me.Toggle2 = date
Else
Me.Toggle2 = Null
End If
End Sub
 
You don't want to set the value of the toggle button to Date(), you want to set the value of some textbox.
 
I'm not sure what you mean...

If I set the toggle to a text box how will it know what to put in there? can you give me an example?
 
Bob gave you an example:

Code:
If Me.YourToggleButtonNameHere Then
  Me.[COLOR="Red"]YourDateTextBoxNameHere[/COLOR] = Date()
Else
  Me.[COLOR="Red"]YourDateTextBoxNameHere[/COLOR] = Null
End If

Note that the part in red is a different control than the toggle. You use the toggle to determine what value to set the textbox to. You're not setting the value of the toggle, as you can't. A toggle will simply have a value of True or False, depending on whether it is depressed or not.
 
Sweet! that worked... I also got this to work too.. I made the control source the text box..

Private Sub Toggle2_AfterUpdate()
If Me.Toggle2 Then
Me.Toggle2 = Format(Now(), "Short Date")
Else
Me.Toggle2 = Null
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom