G
Guest
Hello all. Thanks for any help in advance. I will cut most of what i have
down to a few fields that can be worked off.
I have 3 tables:
tblAction with a field "action"
tblInfo with a field "lastname"
I have a form named "Form1" which has 2 combo boxes and a button
combo1 named "cbxlastname" pulls its data from tblInfo lastname field
combo2 named "cbxaction" pulls its data from tblAction action field
button named btnQuery runs the query which will eventually print a report,
for now I cant get the query to work.
Basically I want the Query to run with whatever are in the combo boxes on
Form1. It will work when its blank, it will work with the cbxaction(combo2)
information, however it will not pull from the cbxlastname(combo1)
information. It will also not pull if both combo boxes are filled with
information. It will however, pull if there is no information in them.
here is the SQL for the Query:
SELECT tblPerson_Info.last, tblPerson_Action.action
FROM tblPerson_Action INNER JOIN tblPerson_Info ON tblPerson_Action.last =
tblPerson_Info.last
WHERE (((tblPerson_Info.last)=[Forms]![Form1]![lastname]) AND
((tblPerson_Action.action)=[Forms]![Form1]![action])) OR
(((tblPerson_Action.action)=[Forms]![Form1]![action]) AND
(([Forms]![Form1]![lastname]) Is Null)) OR
(((tblPerson_Info.last)=[Forms]![Form1]![lastname]) AND
(([Forms]![Form1]![action]) Is Null)) OR ((([Forms]![Form1]![lastname]) Is
Null) AND (([Forms]![Form1]![action]) Is Null));
Relationships are set up for the lastname fields in both tables. This is
the common field in both. The primary Key is the ID field.
What am I doing wrong? Dont get too crazy with me, I learn best by example.
Thanks again!
down to a few fields that can be worked off.
I have 3 tables:
tblAction with a field "action"
tblInfo with a field "lastname"
I have a form named "Form1" which has 2 combo boxes and a button
combo1 named "cbxlastname" pulls its data from tblInfo lastname field
combo2 named "cbxaction" pulls its data from tblAction action field
button named btnQuery runs the query which will eventually print a report,
for now I cant get the query to work.
Basically I want the Query to run with whatever are in the combo boxes on
Form1. It will work when its blank, it will work with the cbxaction(combo2)
information, however it will not pull from the cbxlastname(combo1)
information. It will also not pull if both combo boxes are filled with
information. It will however, pull if there is no information in them.
here is the SQL for the Query:
SELECT tblPerson_Info.last, tblPerson_Action.action
FROM tblPerson_Action INNER JOIN tblPerson_Info ON tblPerson_Action.last =
tblPerson_Info.last
WHERE (((tblPerson_Info.last)=[Forms]![Form1]![lastname]) AND
((tblPerson_Action.action)=[Forms]![Form1]![action])) OR
(((tblPerson_Action.action)=[Forms]![Form1]![action]) AND
(([Forms]![Form1]![lastname]) Is Null)) OR
(((tblPerson_Info.last)=[Forms]![Form1]![lastname]) AND
(([Forms]![Form1]![action]) Is Null)) OR ((([Forms]![Form1]![lastname]) Is
Null) AND (([Forms]![Form1]![action]) Is Null));
Relationships are set up for the lastname fields in both tables. This is
the common field in both. The primary Key is the ID field.
What am I doing wrong? Dont get too crazy with me, I learn best by example.
Thanks again!