Hi everyone,
Can anyone show me how to use multiple criteria from 3 or 4 different combo boxes as a filter when openinig a form?
I want the user to select from the following comboBoxes on a form:
------------
System (text)
Discipline (text)
Status (integer)
Employee (integer)
---------
After he has made his selection I want hime to hit a command buttion to open up a form that displays only the records that meets the four criteria above.
I keep getting a "data mismatch error" or a "cannot find the field specified ..." But from looking at previous posts this seems the way to do it.
Here is my [pathetic] code thus far:
-----------------------------
On Error GoTo Err_OpenForm_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PunchItemsComments"
stLinkCriteria = "[SystemID]= "& Me![System]and [DisciplineID] = " & Me![Discipline] and [StatusID] = " & Me![Status] and [PersonAssigned]= " & Me!Employee
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenForm_Click:
Exit Sub
Err_OpenForm_Click:
MsgBox Err.Description
Resume Exit_OpenForm_Click
-------------------------
Any help will be greatly appreciated. I think that maybe the problem lies with teh fact that some of the fields are integer while others are text ???!!?? If so how do I rewrite the strCriteria so accomodate the tow different data types????
Anxiuosly awaiting any help,
ZaZa
Can anyone show me how to use multiple criteria from 3 or 4 different combo boxes as a filter when openinig a form?
I want the user to select from the following comboBoxes on a form:
------------
System (text)
Discipline (text)
Status (integer)
Employee (integer)
---------
After he has made his selection I want hime to hit a command buttion to open up a form that displays only the records that meets the four criteria above.
I keep getting a "data mismatch error" or a "cannot find the field specified ..." But from looking at previous posts this seems the way to do it.
Here is my [pathetic] code thus far:
-----------------------------
On Error GoTo Err_OpenForm_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PunchItemsComments"
stLinkCriteria = "[SystemID]= "& Me![System]and [DisciplineID] = " & Me![Discipline] and [StatusID] = " & Me![Status] and [PersonAssigned]= " & Me!Employee
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenForm_Click:
Exit Sub
Err_OpenForm_Click:
MsgBox Err.Description
Resume Exit_OpenForm_Click
-------------------------
Any help will be greatly appreciated. I think that maybe the problem lies with teh fact that some of the fields are integer while others are text ???!!?? If so how do I rewrite the strCriteria so accomodate the tow different data types????
Anxiuosly awaiting any help,
ZaZa