Date/Time of Form-please help (1 Viewer)

npierson

Registered User.
Local time
Today, 18:34
Joined
May 14, 2001
Messages
42
I made a text box that displays the current date/time using =Now() in the "default value" and "before update" properties; however, it does not display on the first run of the form, it only displays after the first update if the form is kept open. I would like to display the time/date on first run, and eliminate any default values in the other (other than the date/time text box) text boxes on first run. Any help will be greatly appreciated.

Thanks
 

npierson

Registered User.
Local time
Today, 18:34
Joined
May 14, 2001
Messages
42
I'm sorry, but I'm not familiar with the onOpen event, would you mind going into greater detail?

Thanks,

Nick
 

npierson

Registered User.
Local time
Today, 18:34
Joined
May 14, 2001
Messages
42
If nothing else, can someone tell me how to prevent text boxes from displaying any information on first run? I'd like them to be empty.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:34
Joined
Feb 19, 2002
Messages
43,275
Remove the default value from the control. You don't need to have the date/time visible before the record is saved. In fact, it would be inaccurate to do so since you are also recording the time. You want the time the record was saved as opposed to the time someone started editing the record.

As to the rest of the fields, if you don't want them to show when the form is opened to a new record, remove the default values. Then in the BeforeUpdate event of the Form put code to populate the empty fields:

If Len(Trim(Me.txtYourFld)) = 0 Then
Me.YourFld = "some default value"
End If
 

npierson

Registered User.
Local time
Today, 18:34
Joined
May 14, 2001
Messages
42
Pat,

Thanks for your help thus far, but I still need a lot of help, as I still don't understand this, so please try to help if you can:

When the first person enters information, the date is not included in the entry (in the table), also the date is not displayed until the second entry (in the form), so it seems as if it needs to be displayed in order to be updated (As of right now, it only works when the date is displayed). Also, how is it innaccurate to display the date on the form, if the date isn't entered into the table until the user actually submits the information?

Also, regarding:
--------------------------------------------
As to the rest of the fields, if you don't want them to show when the form is opened to a new record, remove the default values. Then in the BeforeUpdate event of the Form put code to populate the empty fields:

If Len(Trim(Me.txtYourFld)) = 0 Then
Me.YourFld = "some default value"
End If
--------------------------------------------

There were no default values in the text boxes that I don't want to display to begin with, but they still display. And, I tried getting the code to work, but it didn't. If I have a text box titled CustomerNum, should I somehow rename it txtCustomerNum, or would I put:

If Len(Trim(Me.txtCustomerNum)) = 0 Then
Me.YourFld = "some default value"
End If

And what default value should I put if I don't want the values to show up?

Also to DES, I went to the site, but I could not find an example of what I'm trying to accomplish.

**As is obvious I am pretty lost, and would like to send a DB example to anyone who is willing to help.

Thanks, and all the help thus far is greatly appreciated.
 

DES

Technoweenie
Local time
Today, 13:34
Joined
Apr 17, 2001
Messages
245
Send it along and I will see what I can do for you
 

Users who are viewing this thread

Top Bottom