Copying value from field to a new record in another table

martlewis

Registered User.
Local time
Today, 11:17
Joined
May 3, 2011
Messages
20
Hi,

I have a table that contains various records with default values in them, table is called Defaults.

I have a table called Invoices which is completed using a form. Each time I start a new record I want various fields on the form to be populated with data from the Defaults table, using various fields in that table but always from record 1 (there's only one record). I guess i need to copy values from the Defaults table to fields in Invoices table when a new record is started but not sure what code to use.

Any suggestions?

Thanks.
 
In the On Current event of the form you could populate the controls using a DLookup() function if the record is a new record

IF me.NewRecord=true THEN

me.control1=DLookup("fieldname1","Default","RecordID=1")
me.control2=DLookup("fieldname2","Default","RecordID=1")

etc. for each control you want to populate

END IF

You will have to substitute your actual control, field and table names in the above.
 
Worked perfectly thankyou.
 

Users who are viewing this thread

Back
Top Bottom