473,382 Members | 1,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Access Multivalue Lookup field - query works... until called from a Form

I have a query that searches 3 multivalue lookup fields (Impact, Implementation and Owners) based on input from 3 combo boxes in a form.

When I run the form, it doesn't recognize that the 3 lookup fields exist and asks me to Enter Parameter Values (once for each of the 3 lookup fields). If I click through those and then choose an option from one of the combo boxes and resubmit the query, the datasheet in my form returns 0 results (after asking me for all three parameters again, twice).

HOWEVER... if I just open the query in datasheet view while the form is open and has one of the combo box options selected, the search works flawlessly.

My intuition is that being inside a form, somehow the lookup field values are being loaded... later. After the SQL is read. I'm not sure this is related to the search not working in the form, but it's plausible since if the field values don't exist yet, then how could the form pull any results based on those values?

Since the query is working outside the form, I'm pretty confident the issue isn't in my SQL but I'm including it here anyway for reference:

Expand|Select|Wrap|Line Numbers
  1. SELECT ideas.idea_id, ideas.display_name, ideas.idea, tblNotes.cost, ideas.created_at, ideas.labels, tblNotes.Impact, tblNotes.Implementation, tblNotes.Owners, Challenge.Challenge, ideas.official_response_type, ideas.department AS Peoplesoft, tblEmpGroups.DEPTS AS Dept, tblEmpGroups.TEAMS AS Team
  2. FROM (Challenge RIGHT JOIN (tblNotes RIGHT JOIN ideas ON tblNotes.idea_ref = ideas.idea_id) ON Challenge.ID = ideas.challenge) LEFT JOIN tblEmpGroups ON ideas.employee_id = tblEmpGroups.EmpID
  3.  
  4. WHERE IIf(Forms![IMT]!blanks=True,tblNotes.cost Between Forms![IMT]!LowCost And Forms![IMT]!HighCost Or tblNotes.cost Is Null,tblNotes.cost Between Forms![IMT]!LowCost And Forms![IMT]!HighCost) 
  5.  
  6. And ((IIf(Forms![IMT]!cboImpact Is Null,ideas.idea_id Is Not Null, IIF(Forms![IMT]!cboImpact LIKE "All*",tblNotes.Impact.Value IS NOT NULL, Nz(tblNotes.Impact.Value) = Forms![IMT]!cboImpact)))) 
  7.  
  8. And ((IIf(Forms![IMT]!cboImplementation Is Null,ideas.idea_id Is Not Null, IIF(Forms![IMT]!cboImplementation LIKE "All*",tblNotes.Implementation.Value IS NOT NULL, nZ(tblNotes.Implementation.Value) = Forms![IMT]!cboImplementation)))) 
  9.  
  10. And ((IIf(Forms![IMT]!cboOwners Is Null,ideas.idea_id Is Not Null, IIF(Forms![IMT]!cboOwners LIKE "All*",tblNotes.Owners.Value IS NOT NULL, nZ(tblNotes.Owners.Value) = Forms![IMT]!cboOwners)))) 
  11.  
  12. And ((IIf(Forms![IMT]!Challenge Is Null,ideas.idea_id Is Not Null,Challenge.Challenge=Forms![IMT]!Challenge))<>False)
  13.  
  14. ORDER BY ideas.created_at DESC;
  15.  
The main form contains a navigation form, and a subform that references the query. The query is nested 4 times; the above SQL is where I'm pulling in those three lookups from the original table and setting up the WHERE clauses to search them. You'll note that the lookup field reference (e.g. "tblNotes.Owners.Value") appears twice in each AND IIF clause for each of the three lookup fields, which I think explains why when I search in the form I get the popup about Parameter values twice for each field. That was my clue that it maybe has something to do with what data is getting loaded first. It should also be noted that with no combo options selected for those three fields, the form displays all records correctly (including the values in all three lookups).

I would love any pointers you can offer... I'm pretty sure I need to be looking at the form setup (or maybe do something to the query that will work around the default load order?) but so far my Googling has yielded very little progress.

Thanks in advance,
Jen
Mar 23 '16 #1
1 1028
Well... I don't understand why this worked, but it did so I'm going to share.

I was tracing the problem through each subquery (there are four that perform the search function), starting with the bottom level and working my way up to subform and finally the main navigation form. I knew it was working in idea_query4 but wasn't sure exactly where it was broken. Until adding this mutli-value field, everything was working fine... and the only modifications I'd made to the other subqueries was to include the new field in the SELECT.

Long story short, by getting rid of the table name in each of the SELECT statements, all of a sudden it's working in the form. Example:

Old SELECT (not working):
Expand|Select|Wrap|Line Numbers
  1. SELECT idea_query2.idea_id, idea_query2.display_name, idea_query2.idea, idea_query2.cost, idea_query2.created_at, idea_query2.labels, idea_query2.Impact, idea_query2.Implementation, idea_query2.Owners, idea_query2.challenge, idea_query2.official_response_type, idea_query2.Peoplesoft, idea_query2.Dept, idea_query2.Team
  2. FROM idea_query2...
New SELECT (working):
Expand|Select|Wrap|Line Numbers
  1. SELECT idea_id, display_name, idea, cost, created_at, labels, Impact, Implementation, Owners, challenge, official_response_type, Peoplesoft, Dept, Team
  2. FROM idea_query2...
I would love to understand why this caused an issue.
Mar 29 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Marco Simone | last post by:
Hi, What is your opinion about using Lookup field in table. I would like to use lookup field in table 1, so that I can choose data in combo box from table 2. Is this good design of database? ...
1
by: Zachary Turner | last post by:
I want to make a Lookup Field based on another Lookup field. In other words, I have this table A with two fields: ID and Name, where ID is an Autonumber and Name is a friendly name. Then I have a...
6
by: Liz Malcolm | last post by:
Hello and Thanks in advance for any help. I am using Access 2000. I have a data entry form that opens a main form (using the On Click event of the combo box ) with tab controls and 1 subform on...
1
by: WillieW | last post by:
Hi folks, I have Access 97 and have set up four tables, each with a Primary Key with a file name manually entered. For example, the four tables relate to information stored in a paper file, on...
1
by: LurfysMa | last post by:
I am working on an electronic flashcard program. Most of the subjects are simple lists of questions and answers. Those seem to be working. Some of the "subjects" have "categories" of questions. ...
7
by: samdev | last post by:
I have set up a table with a few fields that are set to required....all work fine except the fields that are Lookup from another table. What am I forgetting to set? Thanks!!
1
by: Lori Jones | last post by:
Access 2007, have seen several posts on this, but no answer. Trying to load from Query in the Advanced Filter, but no filters/queries show up. I can create a filter and choose to save it as a...
3
by: roguetexan | last post by:
I have over 1000 records in a table (Context_Tasks_DB), one field of which (termed Purpose) should really be a Lookup to another table (tblPurpose), but currently simply has text (only 30 unique text...
1
by: Dani | last post by:
I'm a newbie who went ahead and designed my tables with lookup fields because I didn't know any better until I couldn't get the results I wanted in my report. I am now in on the secret--they ARE...
10
by: Diplodok | last post by:
My question is closed to remove replication data from my database. For that I create new database and write vba code for transfer all objects from old replicable database, except tables. For tables...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.