Updating control based on another table

Monovian

New member
Local time
Today, 20:22
Joined
Mar 3, 2012
Messages
1
I have a form based on two tables. Table A Holds advert data and Table B holds the advert types and their fee. The form is for the entry of new adverts and records data in Table A. When I enter the advert type code (from Table B) in one control I would like the fee (also from Table B) to be shown in another control and saved in the adverts table. How do I achieve that please?
 
Howzit

In the after update event procedure of your advert type control you want to assign the fee using a dlookup.

Something like the following:

If the advert type code is a number

Code:
me.yourfeectrl = dlookup("[YourFeeField]","tableA","[AdvertTypeCodeField]=" & me.yourtypecode)

if your advert type code is text

If the advert type code is a number

Code:
me.yourfeectrl = dlookup("[YourFeeField]","tableA","[AdvertTypeCodeField]='" & me.yourtypecode & "'")
 
Ignore this line

If the advert type code is a number

the second time it appears in Kiwiman's post!

The second code example is correct for advert type code when it is Text.
 
Howzit

Thanks linq - didn't spot that
 

Users who are viewing this thread

Back
Top Bottom