Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate a date field

Status
Not open for further replies.
Jun 18, 2002
126
US
I need to populate a date field based on another field recieving information. Usually when I use check boxes I use the following code

If Me.cmdCensus = -1 Then
Me.cmdDate = Date
Else
If Me.cmdCensus = 0 Then
Me.cmdDate = Null
End If
End If

This won't work on items that are not text boxes - what can I use?
Melissa
 
field1 is your "another field" which is being updated
field2 is the date field

afterupdate event of field1

'if field1 is blank then field2 is also blank

if field1.text = "" then
field2.value = ""

else if

'if field1 is not blank then field2 shows the date/time

if field1.text <> &quot;&quot; then
field2.value =now()

end fi
end if


 
Thank you, works great. I just want the date without the time. The Date function does not seem to work, nor does sysdate. Why will it only retrieve the now() function with a value?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top