MisMatch

A

Amour

Hi I am trying to write each record that matches to a report, but I keep
getting a mismatch or a object required error. Can someone please help.
Were I get the error is on line 2.
Thank You, Amour

chkstatus = DLookup("[STATUS]", "tblPersonnel")
If chkstatus = "A" Or "C" Or "P2" Or "C2" Then
totalnumber =
Forms!frmpersfilterexpertise1!frmPersFilterExperience.Form!cbxExpChoice.ListCount
qrystring = "[TEXT] like "
For x = 0 To totalnumber - 1
row =
Left(Forms!frmpersfilterexpertise1!frmPersFilterExperience.Form!cbxExpChoice.ItemData(x), 11)
qrystring = qrystring & "'" & row & "' or [TEXT] like "
Next
qrystring = Left(qrystring, Len(qrystring) - 15)
'filtexper =
Forms!frmpersfilterexpertise1!frmPersFilterExper.Form!cbxExpertise
'qrystring = "[TEXT] = '" & filtexper & "'"
'If
IsNull(Forms!frmpersfilterexpertise1!frmPersFilterExper.Form!cbxExpertise)
Then
'MsgBox "You need to pick at least one Expertise!"

'Forms!frmpersfilterexpertise1!frmPersFilterExper.Form!cbxExpertise.SetFocus
'printit = False
'End If

End If
 
D

Duane Hookom

Line 2 should be something like:
If chkstatus = "A" Or chkstatus = "C" Or _
chkstatus = "P2" Or chkstatus = "C2" Then
'....
End If
or maybe
Select Case chkStatus
Case "A", "C", "P2", "C2"
'....
End Select

There are even more options.
 
A

Amour

Thank You this got rid of the error, but for some reason I am getting all the
records. I am not getting just the records selected by the If statement or
Case statement (I tried both), but am getting all the records. Thank You for
anymore help you can give. Amour

Duane Hookom said:
Line 2 should be something like:
If chkstatus = "A" Or chkstatus = "C" Or _
chkstatus = "P2" Or chkstatus = "C2" Then
'....
End If
or maybe
Select Case chkStatus
Case "A", "C", "P2", "C2"
'....
End Select

There are even more options.

--
Duane Hookom
MS Access MVP

Amour said:
Hi I am trying to write each record that matches to a report, but I keep
getting a mismatch or a object required error. Can someone please help.
Were I get the error is on line 2.
Thank You, Amour

chkstatus = DLookup("[STATUS]", "tblPersonnel")
If chkstatus = "A" Or "C" Or "P2" Or "C2" Then
totalnumber =
Forms!frmpersfilterexpertise1!frmPersFilterExperience.Form!cbxExpChoice.ListCount
qrystring = "[TEXT] like "
For x = 0 To totalnumber - 1
row =
Left(Forms!frmpersfilterexpertise1!frmPersFilterExperience.Form!cbxExpChoice.ItemData(x),
11)
qrystring = qrystring & "'" & row & "' or [TEXT] like "
Next
qrystring = Left(qrystring, Len(qrystring) - 15)
'filtexper =
Forms!frmpersfilterexpertise1!frmPersFilterExper.Form!cbxExpertise
'qrystring = "[TEXT] = '" & filtexper & "'"
'If
IsNull(Forms!frmpersfilterexpertise1!frmPersFilterExper.Form!cbxExpertise)
Then
'MsgBox "You need to pick at least one Expertise!"

'Forms!frmpersfilterexpertise1!frmPersFilterExper.Form!cbxExpertise.SetFocus
'printit = False
'End If

End If
 
D

Duane Hookom

Your code is taken completely out of any context. I can only suggest you try
some debugging by stepping through your code and/or using Debug.Print or
MsgBox.

--
Duane Hookom
MS Access MVP

Amour said:
Thank You this got rid of the error, but for some reason I am getting all
the
records. I am not getting just the records selected by the If statement
or
Case statement (I tried both), but am getting all the records. Thank You
for
anymore help you can give. Amour

Duane Hookom said:
Line 2 should be something like:
If chkstatus = "A" Or chkstatus = "C" Or _
chkstatus = "P2" Or chkstatus = "C2" Then
'....
End If
or maybe
Select Case chkStatus
Case "A", "C", "P2", "C2"
'....
End Select

There are even more options.

--
Duane Hookom
MS Access MVP

Amour said:
Hi I am trying to write each record that matches to a report, but I
keep
getting a mismatch or a object required error. Can someone please
help.
Were I get the error is on line 2.
Thank You, Amour

chkstatus = DLookup("[STATUS]", "tblPersonnel")
If chkstatus = "A" Or "C" Or "P2" Or "C2" Then
totalnumber =
Forms!frmpersfilterexpertise1!frmPersFilterExperience.Form!cbxExpChoice.ListCount
qrystring = "[TEXT] like "
For x = 0 To totalnumber - 1
row =
Left(Forms!frmpersfilterexpertise1!frmPersFilterExperience.Form!cbxExpChoice.ItemData(x),
11)
qrystring = qrystring & "'" & row & "' or [TEXT] like "
Next
qrystring = Left(qrystring, Len(qrystring) - 15)
'filtexper =
Forms!frmpersfilterexpertise1!frmPersFilterExper.Form!cbxExpertise
'qrystring = "[TEXT] = '" & filtexper & "'"
'If
IsNull(Forms!frmpersfilterexpertise1!frmPersFilterExper.Form!cbxExpertise)
Then
'MsgBox "You need to pick at least one Expertise!"

'Forms!frmpersfilterexpertise1!frmPersFilterExper.Form!cbxExpertise.SetFocus
'printit = False
'End If

End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top