Hey guys, field values based upon other fields problem

Callum

Registered User.
Local time
Today, 07:15
Joined
Jul 15, 2011
Messages
14
hi, heres what i want to do.

i want field 2 (Address) to be based off field 1 (Names)

so, name = John address must be = Street1

is this possible? ive tryed to put in the afterupdate part this:

If Me.name = "john" then me.Address = "Street1"

doesnt work, but no error, help requested, thanks
 
Howzit

The syntax looks correct but you may find that you are having trouble with Reserved words. Name is a reserved words so you should avoid using this as a field name. Also when you refer to Me.Name this will refer to the form name, not the control on the form called name, which is prossibly why you are getting no results.

I asssume that you have the addresses stored in a table releveant to the record, if you do then you can use Dllokup to get the correct addresss.
 
would you care to expand on the Dlookup?

thank you for the tips
 
Howzit

As an example I have a table called tblCustomers, with fields holding CustId, CustName, SalesTax...

When I create a new invoice for my customers I select the CustID and populate the SalesTaxID in the Invoice table using the After Update Event Procedure

Code:
me.SalesTaxID = Dlookup("[SalesTax]","tblCustomers","[CustId]=" & me.CustID)

There are plenty of examples on this forum and others.
 
Sorry - I am off now for the rest of the day. If you have oither questions I am sure someone else will jump in otherwise I'll pick up again when I get back.
 

Users who are viewing this thread

Back
Top Bottom