DLookup in a subform

Puffet

New member
Local time
Tomorrow, 01:59
Joined
May 26, 2009
Messages
5
Hi,
I am an excel VBA dude who is new to Access and I am loving it. A whole new world out there to get my teeth into. :)

I have my first big problem and I need some advice. :rolleyes::mad:

I need to write a Dlook up and I am not getting it correctly.

The dlookup will reside in a text box or combo box and this is what I need:
Code:
Fetch the "Guest_First_Name" from Table "Guest_Table" using the Guest_ID as the reference that equals the Guest_ID that resides in the "GamedriveGuestJoinTable" or the "GamedriveGuestJoinTable subform".
Code:
With the Dlookup as above do you reference the form that you are working on or the underlying table?
Anyhelp with this code would be most appreciated.
Thanks
Mr Puffet
 
Dont quite understand your question... But D...anything D = database = table, never a form.

D...anything though should be used as little as possible! Why not use a subform?? Or a query?

P.S.
Welcome to the wonderfull world of Access and a hole new way of thinking, please forget everything you think you know and start fresh...
Also welcome to the forum :)
 
Hey thanks for the quick reply.

I feel welcome already.

In summary I aleady have a subform but the subform does not have all the data I want. So I am trying to pull through extra data relating to the record via a Dlookup.

I cant get the Dlookup to work.

I need to fetch the Guest_surname from the Guest Table. In order to fetch it it must take the Guest Id on the Subform and compare it to the Guest ID on the Guest Table.

I think one of the problems is that I am writing the string wrong.

= Dlookup(" [Guest_Table]![Guest_Surname_Name] ", "[Guest_Table]", [Guest_Table]![Guest_ID] = [GamedriveGuestJoinTable]![GamedriveGuestJoinID] )

I am not sure if this is correct because I am working in a Sub Form.

Puffet
 
Subforms can contain yet more subforms...

I am not even going into this whole DLookup thing, this will just create a mess in your forms once you get into the habbit of using this...

Use a subform, use an unbound combo or use a query to feed your subform, then add the name you need into the query... Which ever way... but dont use a DLookup for this
 

Users who are viewing this thread

Back
Top Bottom