A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Lookup in the Form



 
 
Thread Tools Display Modes
  #21  
Old February 3rd, 2009, 02:30 PM posted to microsoft.public.access.forms
Eric[_20_]
external usenet poster
 
Posts: 18
Default Lookup in the Form

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"
...
On Tue, 3 Feb 2009 10:04:31 +0800, "Eric" wrote:



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 W. Vinson [MVP]



  #22  
Old February 3rd, 2009, 05:24 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Lookup in the Form

On Tue, 3 Feb 2009 22:30:00 +0800, "Eric" wrote:

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)?

--

John W. Vinson [MVP]
  #23  
Old February 4th, 2009, 02:19 PM posted to microsoft.public.access.forms
Eric[_20_]
external usenet poster
 
Posts: 18
Default Lookup in the Form

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"
...
On Tue, 3 Feb 2009 22:30:00 +0800, "Eric" wrote:

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)?

--

John W. Vinson [MVP]



  #24  
Old February 4th, 2009, 06:41 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Lookup in the Form

On Wed, 4 Feb 2009 22:19:50 +0800, "Eric" wrote:

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.

--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:35 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.