How to make @Environment work in Search

I have the following code to get the document with a serial number the user has input, and then use the number to search for the database to get the document:

serial = Inputbox$(“Please enter the person’s serial number:”)

Call session.SetEnvironmentVar( “SER”, serial )

Query = |SELECT Form = “Record” & sernum = @Environment(“SER”)|

Set dc = db.search( Query, Nothing, 0)

However, even if I enter a valid serial number and I know there is a document existing in the database with field sernum = the number I entered, it still returns 0. When I used the debugger, it looks like it couldn’t convert the @Environment (“SER”) into the number, it shows in Query variable as “SELECT Form = ““Record”” & sernum = @Environment(”“SER”“)”.

Anybody has idea as to how to search db using @Environment?

Thank you for your help!

Hut

Subject: How to make @Environment work in Search

Hi there,

Is there some other reason why you need this in an environment variable?

try this for your query if not…

Query = |Select Form = “Record” & sernum = “| + serial + |”|

Cheers,

Mark

Subject: RE: How to make @Environment work in Search

Thanks a million. You’re the best! I use @Environment since I couldn’t figure out how to use variable in program.

Thanks again!

Hut

Subject: RE: How to make @Environment work in Search

you should read this articlei found it very useful

http://lotusadvisor.com/doc/11365