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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Field

Status
Not open for further replies.

shaz123

Technical User
Oct 13, 2006
60
DE
Hi,

I have a date field on a form, by using the code : now(), however it only really shows the current date when I open the form.

as i need to log the time an individual has attempted to click on a command button on a form it is not wkrking correctly as the date and time is exactly the samne even though there is a seconds between clicking on the command buttons. Any ideas how to get that date and time always up to date?

 
Use Now() in the code, or update the form field before running the code.
 
How are ya shaz123 . . .

Just to be sure, the [blue]Format[/blue] property should be set to [blue]General date[/blue] . . .

Calvin.gif
See Ya! . . . . . .
 
Hi Aceman,

the format is set to General date, I have put now() in the code. But i still have the same problem, each time i click on diff command buttons, i get exactly the same time even though theres a diff between the times i have clicked on both of them.
How would i get the form field to update before running the code as Remou has suggested?
 
If you want the date field to tick, you can use a timer event. How you set the time in the field depends on what the control source is. If it is =Now(), then a requery of the textbox will work, if there is no control source you can just use the same code that you used to set it in the first place.

I think it might be best to post the code you used with Now in it, because the is no reason it should not work.
 
Thanxs for the quick response, HOw wuld u get the timer event to wrk?.

The text field (Text49) i have used has no control source, but i have set to =Now(),

Below the the line of code i have used

Stringy1 = InputBox("Transaction Date, (DD / MM / YY)", "Spec Gas System", Me!Text49 = Now())

once the command button is clicked on then the date is inputed into an input box. The rest of my coding would then insert relvant cylinder information and the date into a table. When clicking on another command button the exact same date appears as when clicking on the first comaand button.
 
There is a small problem with your line. Try this one:

Stringy1 = InputBox("Transaction Date, (DD / MM / YY)", "Spec Gas System", Now())

When I tried your line it returned the word False, as I would expect, not a date.

To get the timer to work you need to set a Timer Interval for the form, Timer Interval is the very last property on the events pages and it works in thousands of a second (1000=1 second). After you have set this, you can use the timer event to run code.
 
Hey, thanx for that it seems to be wkring. It is putting in two diff times when clicking on a diff comman buttons. [2thumbsup]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top