Rob

Its a good idea to have a string variable, build it up and pass it to Run
Command. The you can print it out or note it to help debugging.

You haven't (by the look of it) got spaces in your command which will blur
words together and if you're doing string comparison you also need to put
quotes around your variable.

Also - don't use the reserved name Selection for your result - better to
call it myTab or somesuch - nb if you use the noselect operator you don't
get the result highlighted on screen which can be a big performance enhancer
on large tables. Its better to use "&" for string concatenation rather than
"+" for ease of understanding (ie its not a number) but not essential.

Your code should probably look like - 

Dim sTemp as string

sTemp = "Select * From " & acqh & " Where " & Desc &  " like " 
&  chr$(34) & "%" & Acqh_Desc & "%" & chr$(34) & " Into myTab noselect"

Print sTemp 'For debug
Run command sTemp 

HTH

Paul Crisp
Syntegra

Direct:  0191 461 4522 
Mobile: 0776 414 3762
Fax: (0191) 461 1959

Innovation Place Metro Riverside Park
Delta Bank Road Gateshead Tyne & Wear NE11 9DJ


-----Original Message-----
From: Robert Brough [mailto:[EMAIL PROTECTED]]
Sent: 05 October 2001 16:17
To: [EMAIL PROTECTED]
Subject: MI-L MB select using string variable and Run Command problem


Dear list,
If I have a table called acqh which has a column called Desc and I wish to
select all the rows that have the word "land" somewhere in the Desc
column I can type:

Select * from acqh where Desc like "%Land%" into Selection

In the MapBasic window.

I am trying to replicate this in MapBasic using a string variable in place
of
the word Land.

I have been experimenting with the Run Command statement but have not
been able get it to function correctly. 

Run Command "Select *
From"+acqh+"Where"+Desc+"like"+Acqh_Desc+"Into Selection"


(Acqh_Desc is the string variable).
Using the code above produces the error message variable or field Desc
not defined when the compiled mbx is run and I don't know why.
My second problem is how to incorporate the "%%" wildcard element into
this statement.

Any help or with the two problems above would be really gratefully
recieved.

Thanks,
Rob Brough
The National Trust
Cornwall Regional Office
Lanhydrock
Bodmin
Cornwall
UK.
e-mail: [EMAIL PROTECTED]



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.


********************************************************************

This email may contain information which is privileged or confidential. If you are not 
the intended recipient of this email, please notify the sender immediately and delete 
it without reading, copying, storing, forwarding or disclosing its contents to any 
other person
Thank you

Check us out at http://www.syntegra.com

********************************************************************



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to