Sky, Shouldn't the statement be: ". . . and LWHS = '" & WhseText & "'" You are sending the &WhseText as part of the statement, which would be incorrect. You want to send the entered value to search for. Thus you put an apostrophe right before the search value, close the statement with a quote, substitute the search value entered (this is outside the statement), then close the statement value with another apostrophe which would be entered within quotes. Thus, if the user enters E4, this would send the following up: and LWhs = 'E4' . Make sense? Bill "skywalker"
wrote in message news:4e68137b.3@WebX.WawyahGHajS... > I have a sql statement that reads: > With rs > .Open "Select LWHS, LPROD, LLOT, LLOC, LOPB, LRCT, LISSU, LADJU from ILIL01 where LPROD Like('NF%') and LWHS = &WhseText", _ > Con1, adOpenStatic, adLockOptimistic, adCmdText > > This statement works if I deleted the last selection LWHS=&WhseText. > WhseText is a TextBox object, users typed this value and I want to limit selection into this parameter. I just cant figured out if this will work on this statement. Will Somebody help me with the correct syntax. Thanks a lot > Sky