You can do this in several ways. One way is the one you have written
yourself

Select ID From MYTABLE Where ID = var_id

This syntax will work for both char, integer and other types.

You can also use the Run Command approach:

szCmdStr = "Select ID From MYTABLE Where ID = " & var_id
Run Command szCmdStr

If your column contains strings you need to add quotations marks around your
variable, like this:
szCmdStr = "Select ID From MYTABLE Where ID = " & Chr$(34) & var_id &
Chr$(34)
Run Command szCmdStr

The command string approach is usefull if you have an unknown number of
expression to add to your Where statement.

Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT
 
COWI A/S
Rug�rdsvej 55
DK-5000 Odense
Denmark
 
Tel     +45 6313 5013
Direct  +45 6313 5008
Mob     +45 5156 1045
Fax     +45 6313 5090
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk
COWI GIS konference afvikles i dagene d. 2.-3. september.
Se yderligere oplysninger p�  www.cowi.dk/Div04/Profiles/nyheder.asp



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, September 09, 2003 6:07 AM
> To: [EMAIL PROTECTED]
> Subject: MI-L Where clause
> 
> 
> If I want to select all records where the id equals a set 
> variable how do I format the syntax?
> 
> ie
> 
> var_id = 12
> select id from table where id = var_id
> 
> 
> Regards
> 
> Andrew
> 
> ------------------------------------------------
> The information in this e-mail together with any attachments 
> is intended only for the person or entity to which it is 
> addressed and may contain confidential and/or privileged 
> material. Any form of review, disclosure, modification, 
> distribution and/or publication of this e-mail message is 
> prohibited. If you have received this message in error, you 
> are asked to inform the sender as quickly as possible and 
> delete this message and any copies of this message from your 
> computer and/or your computer system network.
> 
> 
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | 
> www.directionsmag.com | To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED]
> Message number: 8306
> 
> 

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 8308

Reply via email to