From: Stuart McCall on 8 Apr 2010 16:45 "Tom Lake" <toml_12953(a)hotmail.com> wrote in message news:A3D5131B-828F-475B-9540-CD99EA727A9F(a)microsoft.com... > > "toby131" <toby131(a)discussions.microsoft.com> wrote in message > news:9623E508-81C3-476A-88A3-CFCF9CB31C21(a)microsoft.com... >> Thank you, that fixed the problem. Would you be able to explain to me >> the >> use of the quotes and "&"s in this context or point me to a reference so >> I >> can better understand? Thanks again for your help! > > That's how BASIC works. > The criteria string has to be a legal BASIC string. > Here's an old-style BASIC program to illustrate: > > FirstID$ = "413456" > PartNo$ = "345667" > > PRINT "Output:" > Criterion1$= """[ID]<>FirstID AND [PartNo] = [PartNo]""" > Criterion2$ = """[ID] <>'" & FirstID$ & "' AND [PartNo]='" & PartNo$ & > "'""" > PRINT Criterion1$ > PRINT Criterion2$ > PRINT "End Program." > run > Output: > > "[ID]<>FirstID AND [PartNo] = [PartNo]" > > "[ID]<>'413456' AND [PartNo]='345667'" > > End Program. > > > See the difference? In the first one, FirstID and PartNo are > part of the string constant. In the second one, they're string > variables and the *values* of FirstID$ and PartNo$ are inserted > into the criterion instead. > > Tom Lake I think that's the best illustration of the concept I've seen. <applause> The only snag (there's always one :) is that type-declaration-chars will be confusing, because most folks on here (minus the MVPs of course) have never run across them.
First
|
Prev
|
Pages: 1 2 Prev: how to refer to all rows in a list box Next: Changing total on one row in Continous Form |