How to check a field from a different table

P

pokdbz

I have a fields SSN and Set in the table Provider.

I need to find what is in the Set field for the SSN field in the same table.
I am doing this on a different form called Main.
 
D

Dennis

Assuming SSN is text and is a field on your form, set the control source
property of a textbox on your form to

=DLookUp("Set","Provider","SSN = '" & Me.SSN & "'")
 
P

pokdbz

How does Dlookup evalutate? If I do it this way is it a boolean or 1 or 0
for true or false?
 
G

Garret

Dennis, I've had some trouble with Dlookup before, can you explain to
me how it works? =) Thanks
 
P

pokdbz

Will this enable be to get information from the field 'Set' if so how do i
access this field?
 
D

Dennis

The DLookup statement is saying in English, Get me the 'Set' field from the
table 'Provider' where the 'SSN' field in the table matches the SSN field I
have selected or entered into the SSN field on my form.
e.g.
Table Conversion
Set SSN
Test1 AB
Test2 CD
Test3 EF

A textbox on a form with the control source set to
=DLookUp("Set","Conversion","SSN = 'CD'")
will put Test2 into this textbox.
 
D

Dennis

The DLookup statement is saying in English, Get me the 'Set' field from the
table 'Provider' where the 'SSN' field in the table matches the SSN field I
have selected or entered into the SSN field on my form.
e.g.
Table Conversion
Set SSN
Test1 AB
Test2 CD
Test3 EF

A textbox on a form with the control source set to
=DLookUp("Set","Conversion","SSN = 'CD'")
will put Test2 into this textbox.
 
G

Garret

Ah ha, now if you used this code on, say, a list box, how does this
control source differ from the row source?
 
D

Dennis

Not sure, I've never used a DLookup on the control source of a listbox. The
row source of the list box determines what is in the list and the control
source is what is selected and what will be stored it it is bound to a table.
I suspect if you use a DLookup on the control source & it looks up a valid
item in the list then this item will be pre-selected and the list box will
become non-editable.
 
Top