B
Brook
Marshall,
Just to let you know, all remaining searches are working fine... i'm just
having trouble with this one b/c of the quotes for the inches, if all else
fails I can set up a field without the quotes for inches...
But here is the code that I updated, and i'm not getting any errors but
its not returning any results for any records:
Private Sub Command31_Click()
Dim strWhere As String
If Not IsNull(cboSizeFeet) Then
strWhere = strWhere & " AND [SizeFt]=" _
& """" & Replace(cboSizeFeet, """", """""") & """"
End If
Me.Filter = Mid(strWhere, 6) 'set filter w/o extra AND
Me.FilterOn = True
End Sub
Any other suggestions? if I can't get it to work, I have a work around field
that I can use for the size.
Brook
Just to let you know, all remaining searches are working fine... i'm just
having trouble with this one b/c of the quotes for the inches, if all else
fails I can set up a field without the quotes for inches...
But here is the code that I updated, and i'm not getting any errors but
its not returning any results for any records:
Private Sub Command31_Click()
Dim strWhere As String
If Not IsNull(cboSizeFeet) Then
strWhere = strWhere & " AND [SizeFt]=" _
& """" & Replace(cboSizeFeet, """", """""") & """"
End If
Me.Filter = Mid(strWhere, 6) 'set filter w/o extra AND
Me.FilterOn = True
End Sub
Any other suggestions? if I can't get it to work, I have a work around field
that I can use for the size.
Brook
Marshall Barton said:Brook said:did you see my last question regard the field size?
Also you mentioned having all the searches from one command button. I tried
it, but it isn't working. Here is the code:
Private Sub Command46_Click()
Dim strWhere As String
If Not IsNull(cbodesignnumber) Then
strWhere = strWhere & " AND [DesignNumber]=" _
& """" & cbodesignnumber & """"
End If
If Not IsNull(cboSizeFeet) Then
strWhere = strWhere & " AND [SizeFt]=" _
& """" & cboSizeFeet & """"
End If
If Not IsNull(cbodesign) Then
strWhere = strWhere & " AND [DesignName]=" _
& """ & cbodesign & """
End If
Me.Filter = Mid(strWhere, 6) 'set filter w/o extra AND
Me.FilterOn = True
End Sub
Yes, I now see the size question. This is the old quoted
quotes issue. Any time the value of a string contains quote
marks and it is going to be included inside quote marks, the
imbedded quote must be doubled up. Sounds like double speak
to me too ;-)
For example:
str = "He said, "Hello""
has ambiguous syntax that can not be parsed. The way to
make it follow the above rule is to use:
str = "He said, ""Hello"""
You can achieve that effect within the combo box's value is
to make the statement even more general:
strWhere = strWhere & " AND [SizeFt]=" _
& """" & Replace(cboSizeFeet, """", """""") & """"
which I agree is kind of confusing all by itself. An
Alternative way to do the same thing is:
strWhere = strWhere & " AND [SizeFt]=" & Chr(34) _
& Replace(cboSizeFeet, Chr(34), Chr(34) & Chr(34)) & Chr(34)
Well, that may not really clarify things all that much, but
if you think about it, in spite of the headache, you can
gain a fair insight into the issue.
********
Another problem in your code is that you miscounted the
number of quotes in the DesignName block of code.
********
Are you sure the DesignNumber field in the table is a Text
field?