insert current date and time into new forms only

A

AngelaB

We've been using a form in which the users have entered the date and time
that they completed the form. I'd like to use Now() but do not want to
change the dates and times on previously completed forms. When I change the
control source in the design of the form it changes the dates on everything.
TIA - Angela
 
D

Dennis Schmidt

Hi Angela,

My name is Dennis Schmidt. Thank you for using the Microsoft Newsgroups.

That's because you have created an unbound textbox when you replaced the
name of a field in the control source with an expression. In order to
change the value for the current record, change the control source back to
the field that stores the value. Then use some event to execute code that
sets the value. For instance, using the form's BeforeUpdate event would
fire the following code when any change was made to the record:

Me!DateTextboxName = Now()

I hope this helps! If you have additional questions on this topic, please
reply to this posting.

Need quick answers to questions like these? The Microsoft Knowledge Base
provides a wealth of information that you can use to troubleshoot a problem
or answer a question! It's located at
http://support.microsoft.com/support/c.asp?M=F>.

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2001 Microsoft Corporation. All rights
reserved.

Regards,
Dennis Schmidt
Microsoft Support
 
D

Dennis Schmidt

Hi Angela,

Me! refers to the current form. It's a short version of
Forms!FormName!ControlName. Remember to place square brackets [] around
your names if there are spaces.

Joan's idea will also work if there is not already a value in the date
field. My approach changes the value if any other changes\additions are
made to the record.

I hope this helps! If you have additional questions on this topic, please
reply to this posting.

Need quick answers to questions like these? The Microsoft Knowledge Base
provides a wealth of information that you can use to troubleshoot a problem
or answer a question! It's located at
http://support.microsoft.com/support/c.asp?M=F>.

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2001 Microsoft Corporation. All rights
reserved.

Regards,
Dennis Schmidt
Microsoft Support
 
D

Dennis Schmidt

Hi Angela,

Me! refers to the current form. It's a short version of
Forms!FormName!ControlName. Remember to place square brackets [] around
your names if there are spaces.

Joan's idea will also work if there is not already a value in the date
field. My approach changes the value if any other changes\additions are
made to the record.

I hope this helps! If you have additional questions on this topic, please
reply to this posting.

Need quick answers to questions like these? The Microsoft Knowledge Base
provides a wealth of information that you can use to troubleshoot a problem
or answer a question! It's located at
http://support.microsoft.com/support/c.asp?M=F>.

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2001 Microsoft Corporation. All rights
reserved.

Regards,
Dennis Schmidt
Microsoft Support
 
J

Joan Wild

Dennis Schmidt said:
Hi Angela,

Joan's idea will also work if there is not already a value in the date
field. My approach changes the value if any other changes\additions are
made to the record.

Which is what I thought she wanted - 'do not want to
change the dates and times on previously completed forms.'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top