M
Matt Weyland
I would post this on a thread started 12/3/03, but I fear
it may get missed.
I have a form with a subform. The subform lists all
records The subform has a couple of list boxes and a
couple of text boxes. I want to be able to filter the
subform based on the above listed boxes.
My syntax for builing the SQL string is as follows:
Dim ctl As Control
For Each ctl In Controls
If ctl.ControlType = acTextBox Or ctl.ControlType
= acComboBox Then
If Not (IsNull(ctl.Value) Or Trim(ctl.Value)
= "") Then
strSQL = strSQL & ctl.Tag & " like " &
addQuotes("*" & UCase(ctl.Value) & "*") & " AND "
End If
End If
Next ctl
'testing
If IsNull(strSQL) Then Exit Sub
strSQL = "(" & Left(strSQL, Len(strSQL) - 4) & ")" 'this
line is oly to remove the last addition of " AND" to the
string.
my goal is to try and pass the string to the subform as a
flter attribute using a public function called getSQL
where the strSQL is returned.
This doesnt work. It just says the subform is filtered but
the record count is still as if it were not filtered.
The kicker is if in the immediate window I call the
function getSQL and copy that string to the filter line on
the subform then reopen it it works just fine and is
filtering the way it is supposed to. Rather frustrating.
Any help you could assist with this woudl be greatly
appreciated, or if you would prefer I post on the
newsgroups just let me konw.
THanks
MW
mweyland at mnqio dot sdps dot org
it may get missed.
I have a form with a subform. The subform lists all
records The subform has a couple of list boxes and a
couple of text boxes. I want to be able to filter the
subform based on the above listed boxes.
My syntax for builing the SQL string is as follows:
Dim ctl As Control
For Each ctl In Controls
If ctl.ControlType = acTextBox Or ctl.ControlType
= acComboBox Then
If Not (IsNull(ctl.Value) Or Trim(ctl.Value)
= "") Then
strSQL = strSQL & ctl.Tag & " like " &
addQuotes("*" & UCase(ctl.Value) & "*") & " AND "
End If
End If
Next ctl
'testing
If IsNull(strSQL) Then Exit Sub
strSQL = "(" & Left(strSQL, Len(strSQL) - 4) & ")" 'this
line is oly to remove the last addition of " AND" to the
string.
my goal is to try and pass the string to the subform as a
flter attribute using a public function called getSQL
where the strSQL is returned.
This doesnt work. It just says the subform is filtered but
the record count is still as if it were not filtered.
The kicker is if in the immediate window I call the
function getSQL and copy that string to the filter line on
the subform then reopen it it works just fine and is
filtering the way it is supposed to. Rather frustrating.
Any help you could assist with this woudl be greatly
appreciated, or if you would prefer I post on the
newsgroups just let me konw.
THanks
MW
mweyland at mnqio dot sdps dot org