Programming auto field population

  • Thread starter Thread starter tbride00
  • Start date Start date
T

tbride00

Hello - any assistance on the situation below would be
greatly appreciated. I'm having a hard time finding
anything in the resource manuals I have.

I have a form that contains the following fields for
data input:

Problem_id
Problem_type
description_mug
image_mug
status_code
add_date
add_user_id
chg_date
chg_user_id
timestmp

I would like for the inital data entry to automatically
populate add_date, add_user_id (based on the login_id of
the data input employee) and timestmp immediately after
data has been added,

Problem_id
Problem_type
description_mug
image_mug
status_code

are visable on the data input form

I'd also like to subsequently add chg_date and
chg_user_id when data is is changed for the form.

Please send me any tips/suggestions/programming that you
may have that could help me with this! Thanks so much in
advance!
..
 
Add fields to your form for add_date and add_user_id. Set the Visible
property of the fields to No(if you do not want the user to see them). Set
the default value of Add_Date to Now() set the default value of add_user_id
to CurrentUser().

For the Change information - Add Fields to form and set Visible property as
specified above. Then, in the before update Event procedure for the form set
the values of your fields to the Now() and Currentuser() values.

me.txtChangeDate = Now()
me.txtChangeUser = currentuser()

Make sure you put this in the before update EP for the FORM!


HTH
Kat
 
Thanks Katrina:

How do I creat the Event Procedure for the form set? I
appreciate your help in advance.

Thanks.
 
Bring up the form Properties, then Click on the Event tab, then go to the
Before update Event Column. In the drop down, select Event Procedure. Then
click on the ... button beside the column and that will take you to the Code
Section. Type in the values as needed and close the code window. Then close
your form and save.

Note: If you do not want to update the change fields for new records put
this---
If not me.newrecord then
me.txtChangeDate = now()
me.txtChangeUser = currentuser()
end if

HTH
Kat
 
Back
Top