Missing Criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I’m trying to update the coding for a report. I am having problems with the
coding on the form. I have it broken down by certain criteria and they are
all working, but one and I can seem to figure this one out. It looking up a
number field and I am using the following syntax:

If Me!ChooseQuitCode = True Then
If stLinkCriteria <> "" Then stLinkCriteria = stLinkCriteria & " and "
stLinkCriteria = stLinkCriteria & "[dbo_customers.QuitCode] = " & "#"
& ((Me!ChooseQuitCode)) & "#"
End If


Thanks in advance for you help.
 
If you are trying to add a criteria to a number type field, you need to
remove the #, its used for date filter fields

If Me!ChooseQuitCode = True Then
If stLinkCriteria <> "" Then stLinkCriteria = stLinkCriteria & " and "
stLinkCriteria = stLinkCriteria & "[dbo_customers.QuitCode] = " &
((Me!ChooseQuitCode))
End If
===================================
If the filter is string field type, you need to add a single quote

If Me!ChooseQuitCode = True Then
If stLinkCriteria <> "" Then stLinkCriteria = stLinkCriteria & " and "
stLinkCriteria = stLinkCriteria & "[dbo_customers.QuitCode] = " & "'"
& ((Me!ChooseQuitCode)) & "'"
End If
 
Back
Top