• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

Access 2007:Query change based on other criteria

I have the below query set up and I would like to add a condition to perform a different query based on a field value in another table.  

Specifically, if [Table4].[Test] has one of its values, equal to "*", I would like to return [qry3].[Cust ID]; otherwise perform the following.

SELECT [Table1].[Cust ID] INTO [NewTable]
FROM [qry1] INNER JOIN [qry2] ON [qry1].[ Cust ID] = [qry2].[ Cust ID];


How do I modify the query to do this?  Thanks.
0
JCJG
Asked:
JCJG
1 Solution
 
puppydogbuddyCommented:
I think you could simplify things by actually storing the query name as a field in your "lookup" table. Candace Tripp has a demo mdb called "flexible query" on her web site.  After you get on her web site, scroll down alphabetically until you get to the letter "F".

       http://www.utterangel.com/UtterAngel/utterangel.aspx?cat=acc
0
 
als315Commented:
You can also add Table4 and qry3  in your query (may be joins should be changed to left join) and add following column:
CustID: iif([Table4].[Test] = "*",[qry3].[Cust ID],[qry2].[Cust ID])
0
 
burrcmCommented:
The macro design view has a conditions column you can turn on, then you can do an if this do that, if that do this....

Chris B
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now