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

How do I save data to each record

Status
Not open for further replies.

JanesC

Technical User
Jan 15, 2002
29
GB
I downloaded a module which picks up the user id from the registery. The data is displayed in a form using the following control source, =" " & atCNames(1)
What I would like to do is to save the user id of the person who created each new record. Is there a way of saving this data for each record. Everytime I go to another record the data is refreshed.

 
Hallo,

You could write some code in the form's OnCurrent event which would write the data to a field in the underlying query:
if you have a field strName in the table the form is based on then
Me!strName =Nz(atCNames(1),"")
should do it
It could be made more sophisticated, but it may do for starters.

- Frink
 
Thanks cleverclogs, thats exactly what I wanted.
Jane
 
In this case i would add the code to your add new rcord button. First create an empty filed in your table. Once that is done you can enter this code in the on click section of the add new record button. Add this code just above the end sub command
newfield = Nz(atCNames(1),""

this way every time a new record is created this field is updated
 
Thanks guys, i've used a combination of both suggestions so they can click a button if the user id is correct, but the form also sneakily picks up the id anyway. First class service, I'll be back! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top