H
Hiro
Hello Forum Members:
I have a form which has a preview report button. If there is no filtered
recrod, it works, but when there are filtered records, an error message pops
up such as
"Q_Biopsy_Product.CompanyName" or "Q_Biopsy_Product.JawsSize"
I made sure that all the control names are matching with those in the
sCriteria statement. Can you see something that I am doing wrong?
And this is the code:
{starts}
Private Sub cmdPreview_Report_Click()
On Error Resume Next
Dim sCriteria As String
sCriteria = " 1 = 1 "
If FindCompany <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.CompanyName =
""" & FindCompany & """"
End If
If FindSize <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.JawsSize =
""" & FindSize & """"
End If
If cboFilterFenestrated <> "" Then
sCriteria = sCriteria & " AND
Q_Biopsy_Product.JawsFenestrated = """ & cboFilterFenestrated & """"
End If
If FindProduct <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.ProductName =
""" & FindProduct & """"
End If
If FindVolume <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.JawsVolume =
""" & FindVolume & """"
End If
If FindLength <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.Length = """
& FindLength & """"
End If
If FindUsage <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.UsageArea =
""" & FindUsage & """"
End If
If cboFilterPE <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.PE = """ &
cboFilterPE & """"
End If
DoCmd.OpenReport "T_Biopsy_Product", acPreview, , sCriteria
End Sub
{ends}
I have a form which has a preview report button. If there is no filtered
recrod, it works, but when there are filtered records, an error message pops
up such as
"Q_Biopsy_Product.CompanyName" or "Q_Biopsy_Product.JawsSize"
I made sure that all the control names are matching with those in the
sCriteria statement. Can you see something that I am doing wrong?
And this is the code:
{starts}
Private Sub cmdPreview_Report_Click()
On Error Resume Next
Dim sCriteria As String
sCriteria = " 1 = 1 "
If FindCompany <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.CompanyName =
""" & FindCompany & """"
End If
If FindSize <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.JawsSize =
""" & FindSize & """"
End If
If cboFilterFenestrated <> "" Then
sCriteria = sCriteria & " AND
Q_Biopsy_Product.JawsFenestrated = """ & cboFilterFenestrated & """"
End If
If FindProduct <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.ProductName =
""" & FindProduct & """"
End If
If FindVolume <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.JawsVolume =
""" & FindVolume & """"
End If
If FindLength <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.Length = """
& FindLength & """"
End If
If FindUsage <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.UsageArea =
""" & FindUsage & """"
End If
If cboFilterPE <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.PE = """ &
cboFilterPE & """"
End If
DoCmd.OpenReport "T_Biopsy_Product", acPreview, , sCriteria
End Sub
{ends}