variable problem

jbg

Registered User.
Local time
Today, 22:33
Joined
May 12, 2003
Messages
18
Hello,

I'm having a slight problem w/ something: I'm trying to run the following code open up a form w/ filters applied.

Dim stFormName as String
Dim stSearchCriteria as String
Dim i as integer

i = Len(Me!txtAddressSearch)
stFormName = "frmExpenseLog"
stSearchCriteria = "Left([coll_re_street],i) =" & "'" & Me!txtAddressSearch & "'"
DomCmd.OpenForm stFormName, , , stSearchCriteria

The problem is whenever I run the code I get a message box asking for the parameter value of i.

What am I doing wrong, or is there an easier way of doing this? I debugged the code and all of the variables are correct...
 
i needs to be outside of the quotes:

stSearchCriteria = "Left([coll_re_street]," & i & ") =" & "'" & Me!txtAddressSearch & "'"
 
worked! Thank you. I was driving myself crazy...
 

Users who are viewing this thread

Back
Top Bottom