Lookup in the Form

  • Thread starter Thread starter Eric
  • Start date Start date
John,

The answer is : =DLookUp("[Address]","Hotel","[Supplier] = """ & [Supplier]
& """")

however, one question, what if the "return value" is null.
i can edit the field . i.e input whatever data i want ..

Is there any solution ?!

Eric
John W. Vinson said:
John

You are wonderful

I've 2 tables - a) voucher b) hotel

i use voucher as a form where have fields - "supplier" and "address" i
want
user to input the name of supplier in "supplier" and the "address" field
will show the address of the supplier
Both data are saved in table - hotel
In other word, my sources of data is [hotel]

the field that i need to look up is " address" and it depends on the input
of "supplier"

= Dlookup("[address]","hotel","[hotel]="""&[hotel] & """)

But this is not working

I'm sorry, Eric, but this isn't making any sense at all.

You refer to fields named Supplier and Address.

Your query refers to a field named Hotel (and also to a table named
Hotel).

You say you have a table named voucher that you "use as a form". A table
is
one kind of object; a form is a different kind of object. You CAN'T "use a
table as a form".

GUESSING that you have a field named Supplier in the table named Hotel
then

=DLookUp("[Address]", "[Hotel]", "[Supplier] = """ & [something] & """")

might work. I don't know what you should put in for [something] because I
cannot see your form and do not know the context - put the name of
whatever
control on the form would identify the supplier. If supplier is a Lookup
Field
this will need more work - is it?
 
John,

The answer is : =DLookUp("[Address]","Hotel","[Supplier] = """ & [Supplier]
& """")

however, one question, what if the "return value" is null.
i can edit the field . i.e input whatever data i want ..

Is there any solution ?!

Well... it certainly would have shortened the discussion if you'ld mentioned
this earlier. Of course you cannot edit the result of a calculated expression.

What is the context? Where are you using this? Are you trying to *STORE* the
address somewhere (because the DLookUp certainly will not do so)?
 
If possible, the "context" can be saved at the table - [Master] which the
rest of the data are all stored here

Eric.



John W. Vinson said:
John,

The answer is : =DLookUp("[Address]","Hotel","[Supplier] = """ &
[Supplier]
& """")

however, one question, what if the "return value" is null.
i can edit the field . i.e input whatever data i want ..

Is there any solution ?!

Well... it certainly would have shortened the discussion if you'ld
mentioned
this earlier. Of course you cannot edit the result of a calculated
expression.

What is the context? Where are you using this? Are you trying to *STORE*
the
address somewhere (because the DLookUp certainly will not do so)?
 
If possible, the "context" can be saved at the table - [Master] which the
rest of the data are all stored here

I've read this three or four times, Eric, and I still can't make any sense of
it. Please explain again what data you have; where it's stored; and what you
want as a result.
 
Back
Top