Populating Field Values Automatically

C

CK

I've got a button on a form to add additional addresses for the same company
name. On the form is a field to store the company name itself. When I click
the button to add additional addresses, I want the new record to
automatically populate the customer name field from the previous record
without the user entering it again. How do I go about doing that?

Someone in this forum helped me with something like this 2 years ago and I
couldn't recall how it was done except that it had something to do with
playing around with the Default value. Any ideas? Thanks.
ck
 
S

StCyrM

Good morning

You can use the following to carry over a field value from the previous record.
In the example, the txtMarkets and txtWholesaledate are the values carried
over.


Const cQuote = """"

'Carry values forward
Me!txtMarkets.DefaultValue = cQuote & Me!txtMarkets.Value & cQuote
Me![txtWholesale Date].DefaultValue = cQuote & Me![txtWholesale Date].Value &
cQuote

DoCmd.RunCommand CmdRecordsGoToNew


Best Regards

Maurice St-Cyr
Micro Systems Consultants, Inc.
 
Top