Insert 'Now()' into field OnClick

henry_s

New member
Local time
Today, 05:32
Joined
Aug 25, 2004
Messages
5
Hi,

I'm trying to insert the current time (using validation and the 'Now()' function) into a field on a data access page. I know as much as selecting a field and the event, so currently I have

Code:
<SCRIPT language=vbscript event=onclick for=Time Out Logged>

<!--

-->
</SCRIPT>

Could someone help me out with the code I need to insert the current time into the field when it's clicked?

Thanks for any help
 
Setting a textbox

All you need to do is set the textbox name = Now()

for example:

Form Name = "Homepage"
Textbox Name = "txt_Box"

the syntax would be

Forms!Homepage!txt_Box = Now()

-or-

if the function is located in the Homepage form (which it will be)
you can substitute "Forms!Homepage!" with Me.

Me.txt_Box = Now()
 
Thanks for the reply, I thought it would be similar to that... now I've got the following code in the <HEAD> section

Code:
<SCRIPT language=vbscript event=onclick for=SignIn>
<!--
Me.Time_Logged_In = Now()

-->
</SCRIPT>

... but see screenshot...

'SignIn' is a command button, and Time_Logged_In is the text box I want the time to be entered into. I just tried it using an empty text box not linked to a table and same thing occurs. Any ideas anyone?
 

Attachments

  • runtime_error.gif
    runtime_error.gif
    14.9 KB · Views: 195
Last edited:
This has really got me stumped, I'd appreciate any advice or alternative solutions. Thanks.
 

Users who are viewing this thread

Back
Top Bottom