Inserting values in a database..

  • Thread starter Thread starter Thakur8385
  • Start date Start date
T

Thakur8385

Hi,

The table has 3 fields R_ID, Log_Date, Log_Time
When I type the R_ID and click the Log Start Button I want the current date
and the time to be captured in Log_Date and Log_Time...

Please help....

Thakur8385
 
Why not use a single field for DateTime and set default to Now() so when
record is created it captures the date and time?
 
You would be better off storing the date and time in one field.

Assuming that you are doing this on a form you need VBA code in the button's
click event that looks like the following.

ME.Log_Date = Date()
ME.Log_Time = Time()

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
But The data needs to be captured in 2 seperate places in the database as per
the requirement....
 
But The data needs to be captured in 2 seperate places in the database as per
the requirement....
 
What is the requirement? You can always get the time and the date out as
separate items by using the DateValue and TimeValue functions.

On the other hand, you can always combine the two by adding them together. If
you need the current system date and time entered automatically into two field
when a record is created, then use Karl Dewey's suggestion. If for some
reason, you only need the Date and time entered when the user presses a button
and you want to be able to do that at any time, then use my suggestion.



John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top