Chat with a LIVE Microsoft Access Expert!
 
       
 

         

   

Go Back   Access World Forums > Microsoft Access Discussion > Tables

 
 
Chat with a LIVE Microsoft Access Expert!
Reply
 
Thread Tools Rating: Thread Rating: 6 votes, 5.00 average. Display Modes
  #1  
Old 09-01-2004, 10:25 AM
rbriggs
Guest
 
Posts: n/a
Problems with LOOKUP Field!

HI All.

I need help with tthe LOOKUP Field for my tables. I have a form with a subreport/subform on it. My Subreport/subform is setup to be another table. This table is linked to the main form by a key.

I hope all understand untill now. This is fairly straightforward.

Now in my subform, I have specified on of the fields as a lookup. The problem is: I want the lookup expression to use a value in the current row to complete the lookup.

i.e.:
Table1 - A Table in my Access DB
1 | Text
1 | Text2
2 | Hello
3 | Bye
3 | Bye2

Table2 in my Subreport/Subform
3 | [Lookup] <- I want this lookup to get "Bye" and "Bye2" becuase the 3 in THIS ROW is my Key
^ The 3 gets automatically filled on a new record because it is the link so I have this info!

Basically I think I need to know how to find the 3 in my CURRENT ROW! How can I do this in the lookup field?

Reply With Quote
Sponsored Links
  #2  
Old 09-01-2004, 10:59 AM
The_Doc_Man The_Doc_Man is offline
AWF VIP
 
Join Date: Feb 2001
Location: New Orleans, LA, USA
Posts: 6,776
The_Doc_Man is just really niceThe_Doc_Man is just really niceThe_Doc_Man is just really niceThe_Doc_Man is just really niceThe_Doc_Man is just really nice
Lookup is single-valued. It will not find two answers and return them both. This problem stems from the fact that your selection key is not unique, which for a table lookup, it must be.
Reply With Quote
  #3  
Old 09-02-2004, 10:44 AM
rbriggs
Guest
 
Posts: n/a
Oh Well

I was hoping that wasn't the case. I don't think I like this MS Access.
Reply With Quote
  #4  
Old 09-02-2004, 10:59 AM
Pat Hartman Pat Hartman is offline
Super Moderator
 
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 20,669
Pat Hartman is a jewel in the roughPat Hartman is a jewel in the roughPat Hartman is a jewel in the rough
DLookup() is a function. VB/VBA functions return a single value. You could write your own function and return an array. I'm not sure why you don't like Access for this. Please tell us what language you use that acts differently with integral functions.

Your over simplification makes it impossible to decern your actual situation. Are you certain that you need DLookup() at all? Are you sure that you don't want to create a query that joins the main table to the lookup table so that all values from the lookup table will be returned?

Quote:
becuase the 3 in THIS ROW is my Key
- KEYS are unique so 3 can't be a key.
__________________
Bridge Players Still Know All the Tricks
Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:33 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
(c) copyright 2009 Access World