L
Lisa Reber
Hi - sorry if this is a dumb question, but I'm still
new at this.
Have a report that I want to filter with a pop-up form
like the sample in RptSmp97. I've gotten most of the
commands to work, except the most important - the filters.
Each of the combo boxes shows numeric data when it should
show text.
Source is table Products.
Filter1 = SELECT DISTINCT Products.SupplierID FROM
Products ORDER BY Products.SupplierID;
Filter2 = SELECT DISTINCT Products.CategoryID FROM
Products;
Filter3 = SELECT DISTINCT Products.[Tagged?] FROM
Products;
SupplierID and CategoryID are both look-up fields in
Products (is this a foreign key?)
Tagged is a check box - the combo box shows a drop-down
selection of Yes/No, then displays -1 or 0 respectively.
So, as usual, trying to explain the problem helps me
come up with a possible answer. If I make the report
source a query showing Supplier Name from tblSuppliers;
likewise CategoryID from tblCategories - this should
give me text fields rather than numeric ID's?
Second, when I try filtering only on Tagged = Yes, I get
error message: Syntax error (missing operator) in query
expression '([Tagged?] ="-1" A)'.
The OlClick [Event Procedure] is as follows (lifted almost
entirely from the RptSmp97 code):
Private Sub Set_Filter_Click()
Dim strSQL As String, intCounter As Integer
'Build SQL String
For intCounter = 1 To 3
If Me("Filter" & intCounter) <> "" Then
strSQL = strSQL & "[" & Me("Filter" &
intCounter).Tag & "] " & " = " & Chr(34) & Me("Filter" &
intCounter) & Chr(34) & " And "
End If
Next
If strSQL <> "" Then
'Strip Last " And "
strSQL = left(strSQL, (Len(strSQL) - 3))
'Set the Filter property
Reports![rptInventoryItems].Filter = strSQL
Reports![rptInventoryItems].FilterOn = True
End If
End Sub
So I don't know if the problem is 'not in our stars, but
in ourselves' or something - the code doesn't directly
copy, or that the combo box tagged is yes/no not -1/0.
Any help is greatly appreciated - thanks for your patience!
Regards, Lisa
new at this.
Have a report that I want to filter with a pop-up form
like the sample in RptSmp97. I've gotten most of the
commands to work, except the most important - the filters.
Each of the combo boxes shows numeric data when it should
show text.
Source is table Products.
Filter1 = SELECT DISTINCT Products.SupplierID FROM
Products ORDER BY Products.SupplierID;
Filter2 = SELECT DISTINCT Products.CategoryID FROM
Products;
Filter3 = SELECT DISTINCT Products.[Tagged?] FROM
Products;
SupplierID and CategoryID are both look-up fields in
Products (is this a foreign key?)
Tagged is a check box - the combo box shows a drop-down
selection of Yes/No, then displays -1 or 0 respectively.
So, as usual, trying to explain the problem helps me
come up with a possible answer. If I make the report
source a query showing Supplier Name from tblSuppliers;
likewise CategoryID from tblCategories - this should
give me text fields rather than numeric ID's?
Second, when I try filtering only on Tagged = Yes, I get
error message: Syntax error (missing operator) in query
expression '([Tagged?] ="-1" A)'.
The OlClick [Event Procedure] is as follows (lifted almost
entirely from the RptSmp97 code):
Private Sub Set_Filter_Click()
Dim strSQL As String, intCounter As Integer
'Build SQL String
For intCounter = 1 To 3
If Me("Filter" & intCounter) <> "" Then
strSQL = strSQL & "[" & Me("Filter" &
intCounter).Tag & "] " & " = " & Chr(34) & Me("Filter" &
intCounter) & Chr(34) & " And "
End If
Next
If strSQL <> "" Then
'Strip Last " And "
strSQL = left(strSQL, (Len(strSQL) - 3))
'Set the Filter property
Reports![rptInventoryItems].Filter = strSQL
Reports![rptInventoryItems].FilterOn = True
End If
End Sub
So I don't know if the problem is 'not in our stars, but
in ourselves' or something - the code doesn't directly
copy, or that the combo box tagged is yes/no not -1/0.
Any help is greatly appreciated - thanks for your patience!
Regards, Lisa