Hi and Happy New Year!
I have a QBF and a big challenge. I can't seem to get it to work...
I have two tables:
Contact
Contact_Type
I have a form:
Query_Window
On that form end users should be able to tick radio buttons (one or many - there are 16 of them) and/or use a text box where they can enter a full or partial word (one of these), and a few drop down boxes (three of these) that give the end user choices.
I have the query:
qrySearchStatus
To test the form, I chose a few radio buttons, a state and a priority, as soon as I click on the command button “Run Query” a window comes up and says:
Forms!Query_Win dow!TxtCompany
And it does this for each control and finally, no results. No matter what I chose on the form - even if it's just one radio button, or adding a few letters in the text box...
What am I doing wrong? The SQL to the query (qrySearchStatu s) is below. I have no clue what to do.
Thank you!!!
SELECT
Contacts.Compan y,
Contacts.State,
Contacts.Countr y,
Contacts.Priori ty,
Contact_Type.BD ,
Contact_Type.CO ,
Contact_Type.CP ,
Contact_Type.EN ,
Contact_Type.Fo F,
Contact_Type.FA M,
Contact_Type.FC ,
Contact_Type.FO ,
Contact_Type.GP ,
Contact_Type.IN S,
Contact_Type.IP ,
Contact_Type.NH F,
Contact_Type.PB ,
Contact_Type.SM ,
Contact_Type.SW F,
Contact_Type.TH
FROM Contact_Type INNER JOIN Contacts ON Contact_Type.Co ntactID = Contacts.Contac tID
WHERE
(((Contacts.Com pany) Like "*" & [Forms]![Query_Window]![TxtCompany] & "*")
AND
((Contacts.Stat e)=[forms]![query_window]![cboState])
AND ((Contacts.Coun try)=[forms]![query_window]![cboCountry])
AND ((Contacts.Prio rity)=[forms]![query_window]![cbPriority])
AND ((IIf([forms]![Query_Window]![cb1],[BD]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb2],[CO]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb3],[CP]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb4],[EN]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb5],[FAM]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb6],[FC]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb7],[FO]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb8],[FoF]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb9],[GP]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb10],[INS]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb11],[IP]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb12],[NHF]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb13],[PB]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb14],[SM]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb15],[SWF]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb16],[TH]=True,True))=Tr ue))
OR (((Contacts.Com pany) Is Null)
AND ((Contacts.Coun try) Is Null)
AND ((Contacts.Prio rity) Is Null))
ORDER BY Contacts.Compan y;
I have a QBF and a big challenge. I can't seem to get it to work...
I have two tables:
Contact
Contact_Type
I have a form:
Query_Window
On that form end users should be able to tick radio buttons (one or many - there are 16 of them) and/or use a text box where they can enter a full or partial word (one of these), and a few drop down boxes (three of these) that give the end user choices.
I have the query:
qrySearchStatus
To test the form, I chose a few radio buttons, a state and a priority, as soon as I click on the command button “Run Query” a window comes up and says:
Forms!Query_Win dow!TxtCompany
And it does this for each control and finally, no results. No matter what I chose on the form - even if it's just one radio button, or adding a few letters in the text box...
What am I doing wrong? The SQL to the query (qrySearchStatu s) is below. I have no clue what to do.
Thank you!!!
SELECT
Contacts.Compan y,
Contacts.State,
Contacts.Countr y,
Contacts.Priori ty,
Contact_Type.BD ,
Contact_Type.CO ,
Contact_Type.CP ,
Contact_Type.EN ,
Contact_Type.Fo F,
Contact_Type.FA M,
Contact_Type.FC ,
Contact_Type.FO ,
Contact_Type.GP ,
Contact_Type.IN S,
Contact_Type.IP ,
Contact_Type.NH F,
Contact_Type.PB ,
Contact_Type.SM ,
Contact_Type.SW F,
Contact_Type.TH
FROM Contact_Type INNER JOIN Contacts ON Contact_Type.Co ntactID = Contacts.Contac tID
WHERE
(((Contacts.Com pany) Like "*" & [Forms]![Query_Window]![TxtCompany] & "*")
AND
((Contacts.Stat e)=[forms]![query_window]![cboState])
AND ((Contacts.Coun try)=[forms]![query_window]![cboCountry])
AND ((Contacts.Prio rity)=[forms]![query_window]![cbPriority])
AND ((IIf([forms]![Query_Window]![cb1],[BD]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb2],[CO]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb3],[CP]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb4],[EN]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb5],[FAM]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb6],[FC]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb7],[FO]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb8],[FoF]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb9],[GP]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb10],[INS]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb11],[IP]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb12],[NHF]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb13],[PB]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb14],[SM]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb15],[SWF]=True,True))=Tr ue)
AND ((IIf([forms]![Query_Window]![cb16],[TH]=True,True))=Tr ue))
OR (((Contacts.Com pany) Is Null)
AND ((Contacts.Coun try) Is Null)
AND ((Contacts.Prio rity) Is Null))
ORDER BY Contacts.Compan y;
Comment