By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,940 Members | 611 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,940 IT Pros & Developers. It's quick & easy.

Retreive value from a table based on a value on a form

P: 41
This is continuing form my list box question, which i now realise is probably not really linked to list boxes at all!

If i have a field on my form that holds the value of a unique autonumber for another table is there a way i can then do a check on that table and return some other values from that record?

e.g.

my table has 4 columns, (a,b,c and d) i know the value of column a, which is unique.

My form is not bound to this particular table.

What i need to do is check the right table and return the value from column c and d for the record I have the value in column a for.

thanks
Jan 11 '08 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 634
This is continuing form my list box question, which i now realise is probably not really linked to list boxes at all!

If i have a field on my form that holds the value of a unique autonumber for another table is there a way i can then do a check on that table and return some other values from that record?

e.g.

my table has 4 columns, (a,b,c and d) i know the value of column a, which is unique.

My form is not bound to this particular table.

What i need to do is check the right table and return the value from column c and d for the record I have the value in column a for.

thanks
Hi

I can think a 3 ways immediatly but by fare the best is (IMHO) to return the value in the List Box Control Source query. These would be retainin in zero width columns an refered to (returned) in VBA by the list box Column property.

So in the List_AfterUpdate event you can set a variable(s) to the column(s) value for the row clicked.

??

MTB
Jan 11 '08 #2

P: 45
Use Dlookup when you need to find a value in a non-related table.

DLookup(expr, domain[, criteria])

in your case DLookup("[b]", "Other Table name", "[a] = selected value from form")
Jan 11 '08 #3

P: 41
Excellent, thanks for your help!
Jan 11 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.