deejay_totoro
Registered User.
- Local time
- Today, 04:51
- Joined
- May 29, 2003
- Messages
- 169
Hello,
I am trying to pass the value of a text box to a query using VBA. What I have written is not working. Does anyone have any ideas?
Public Function CriteriaToApply()
' First get value in text box. This will be the criteria applied to the query
CriteriaToApply = ([Forms]![frmMain]![MyField])
If (CriteriaToApply) = "All" Then
CriteriaToApply = ' <= Something here to return all records
Else
CriteriaToApply = CriteriaToApply ' <= Will return records that match the text box
End If
End Function
Im the criteria of a field in my query I have placed: =CriteriaToApply()
Any ideas?
Thanks very much!
dj_T
I am trying to pass the value of a text box to a query using VBA. What I have written is not working. Does anyone have any ideas?
Public Function CriteriaToApply()
' First get value in text box. This will be the criteria applied to the query
CriteriaToApply = ([Forms]![frmMain]![MyField])
If (CriteriaToApply) = "All" Then
CriteriaToApply = ' <= Something here to return all records
Else
CriteriaToApply = CriteriaToApply ' <= Will return records that match the text box
End If
End Function
Im the criteria of a field in my query I have placed: =CriteriaToApply()
Any ideas?
Thanks very much!
dj_T