K
Kevin Sprinkel
I began a prototype form to gather a report's filtering
criteria that has four combo boxes. My strategy is to
form the filter string in a hidden textbox by calling a
procedure that loops through the controls from each's
AfterUpdate event.
The following procedure produces an "Object does not
support this property or method" error on the first line
of the For loop:
Private Sub WriteFilterString()
Dim intindex As Integer
Dim ctl As Control
'Reinitialize string
Me!txtFilterString = ""
' Loop through all form controls;
' if there's data, add to filter string
For Each ctl In Me.Controls
If Nz(ctl.Value) <> 0 Then
Me!txtFilterString = Me!txtFilterString & ctl.Value
& " AND "
End If
Next ctl
' Strip end of filter
Me.txtFilterString = Left(Me.txtFilterString, Len
(Me.txtFilterString) - 5)
End Sub
Can anyone reveal my error, and/or suggest a better
strategy for this task?
Kevin Sprinkel
Becker & Frondorf
....ME's build weapons, CE's build targets...
criteria that has four combo boxes. My strategy is to
form the filter string in a hidden textbox by calling a
procedure that loops through the controls from each's
AfterUpdate event.
The following procedure produces an "Object does not
support this property or method" error on the first line
of the For loop:
Private Sub WriteFilterString()
Dim intindex As Integer
Dim ctl As Control
'Reinitialize string
Me!txtFilterString = ""
' Loop through all form controls;
' if there's data, add to filter string
For Each ctl In Me.Controls
If Nz(ctl.Value) <> 0 Then
Me!txtFilterString = Me!txtFilterString & ctl.Value
& " AND "
End If
Next ctl
' Strip end of filter
Me.txtFilterString = Left(Me.txtFilterString, Len
(Me.txtFilterString) - 5)
End Sub
Can anyone reveal my error, and/or suggest a better
strategy for this task?
Kevin Sprinkel
Becker & Frondorf
....ME's build weapons, CE's build targets...