Re-Post - Default Value? (1 Viewer)

EricH

New member
Local time
Today, 05:44
Joined
May 1, 2001
Messages
7
I am trying to get a control to take its Default Value from the VALUE of another control on the same form (lets say CTL2 looks at CTL1).
CTL1 (Country) is automatically filled in from a Customers table via a query, and the CTL2 (Ship-To Country) is normally the same country, but occasionally its different.

When I set the DefaultValue Property for CTL2 to an expression "=[CTL1]" Access actually is looking at the DefaultValue Property setting for CTL1 NOT the VALUE of CTL1.

CTL1 is populated from a query which combines fields from a Customers table (CustID, CustName, CustCountry, etc) and another table (call it MainTable).

There is a lookup control from which I can select CustName then CustCountry is automatically filled in. However, I need a separate field for the Ship-To Country, so I want to offer the CustCountry in the Ship-To Country as a default but change it if different.

How do I get round Access looking up the DefaultValueProperty?

Eric
 

charityg

Registered User.
Local time
Today, 05:44
Joined
Apr 17, 2001
Messages
634
I think you are getting stuck on the default property.

Why not use the afterupdate event of CTL1

Check that an entry isn't already in CTL2 (because I don't think you want to overwrite any previous entry)

CTL1_afterupdate
if isnull(CTL2) or CTL2="" and not isnull(CTL1) then
CTL2=CTL1
endif

this will check that CTL1 is not empty and then give CTL2 the same value.

I hope this is what you're looking for
Charity
 

Users who are viewing this thread

Top Bottom