I am having problems trying to print a report based on a form. This
is a search form only, no data input. There is a query that the form
looks at, but then there are numerous comboxes that you can pick
information from either one or many and press a search button. See
code below for the "Case Select" that was used to make up the
comboboxes. Not a filtered list. My problem is that when I try to
print, it prints all records before the search. I need it to print
what I had just searched. This could be one or many records. I am
learning VB and it can follow it pretty good.
Private Sub cmdSearch_Click()
Dim i As Integer
Dim stWhere As String
Dim stDelim As String
For i = 0 To 12
Select Case i
Case 0: stDelim = "'" 'text data type
Case 1: stDelim = "'" 'text data type
Case 2: stDelim = "'" ' Text data type
Case 3: stDelim = vbNullString ' numeric data type
Case 4: stDelim = vbNullString ' numberic data type
Case 5: stDelim = "'" 'text data type
Case 6: stDelim = "'" ' text data type
Case 7: stDelim = vbNullString 'numeric data type
Case 8: stDelim = vbNullString 'numeric data type
Case 9: stDelim = "@" ' currency data type
Case 10: stDelim = "'" 'text data type
Case 11: stDelim = "'" 'text data type
Case 12: stDelim = "'" 'Text data type
End Select
If Nz(Me("Criteria" & i), vbNullString) <> vbNullString Then
If Me("Criteria" & i) <> "<All>" Then
stWhere = stWhere & " AND " & Me("Criteria" & i).Tag &
" = " & stDelim & Me("Criteria" & i) & stDelim
End If
End If
Next i
If stWhere <> vbNullString Then
stWhere = Mid$(stWhere, 6)
Me.Filter = stWhere
Me.FilterOn = True
Else
MsgBox "Please enter some criteria.", vbExclamation, "No
Criteria Entered"
End If
End Sub
Any help would be great!
Thanks, Jan