Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command contains unrecognized phrase/keyword

Status
Not open for further replies.

PBREP

MIS
Mar 14, 2003
75
US
Hello all, using VFP 5.0, a syntax problem I came across.

Thank you & Happy Thanksgiving to the USA folks!
~PM
&& create a cursor directly from MS Access.
Procedure Ship_Via()
lcmdb="c:\C:\ASCENT\ODBCLINK\nonorm.mdb"
store SQLSTRINGCONNECT(;
'DBQ='+lcmdb+';'+;
'Driver={Microsoft Access Driver (nonorm.mdb)}');
TO gnConnHandle=sqlexec(gnConnHandle,"Instruct.Ship_Via ;","lstcsnum")
sqldisc(0)
Endproc
*********************************
Problem with this line:
TO gnConnHandle=sqlexec(gnConnHandle,"Instruct.Ship_Via ;","lstcsnum")
sqldisc(0)

*Compile Error "Command contains unrecognized phrase/keyword"*

 
I know this has nothing to do with the error, but is this a Typo?

lcmdb="c:\C:\ASCENT\ODBCLINK\nonorm.mdb" ?? you have 2 C:

Ali Koumaiha
TeknoSoft Inc
Farmington Hills, Michigan
 
Yes, sorry Ali, that's a typo; I sill have the error as well.

~PM
 
Try:
Code:
store SQLSTRINGCONNECT(;
   'DBQ='+lcmdb+';'+;
   'Driver={Microsoft Access Driver (nonorm.mdb)}');
   TO gnConnHandle

=sqlexec(gnConnHandle,"Instruct.Ship_Via ;","lstcsnum")
Rick
 
Thank Rick, compile error went away :)

The "sqldisc(0)" caused it...
~PM
 
Ok during runtime I now get an error "Connection handle is invalid" for line:
=sqlexec(gnConnHandle,"Instruct.Ship_Via ;","lstcsnum")

Thanks,
~PM
 
Have you checked to see if you are getting a valid connection? (i.e. gnConnHandle > 0)
After going to and checking under "Access" -> "ODBC", it doesn't look like your syntax matches these examples. Specifically the entry:
Driver={Microsoft Access Driver (nonorm.mdb)}
vs.
Driver={Microsoft Access Driver (*.mdb)}

Rick
 
Hi Rick:

I did try this first:
Driver={Microsoft Access Driver (*.mdb)} && No cigar :)

I tried this:
'Driver={Nonorm(*.mdb)}'); && No Cigar

&&Nonorm is the name of my MS Driver and my database name = nonorm.mdb.

Thanks Rick
 
OK Rick, now it's working, may of been a typo somewhere...

Thanks again,
~PM

Procedure Ship_Via()
lcmdb="C:\ASCENT\ODBCLINK\nonorm.mdb"
store SQLSTRINGCONNECT(;
'DBQ='+lcmdb+';'+;
'Driver={Microsoft Access Driver (*.mdb)}');
TO gnConnHandle
=sqlexec(gnConnHandle,"select Instruct.Ship_Via from Instruct;","lstcsnum")
Endproc
 
One more problem for Rick or anyone out there;

(ref. Figure 1.), I run it, and nothing happens; I am missing a list/view pop-up box that I thought create cursor supposed to do. So I coded the following (ref. Figure 2.), still no results (viewing shipping instructions):

Thanks,
~PM

&& Figure 1.
Procedure Ship_Via()
lcmdb="C:\ASCENT\ODBCLINK\nonorm.mdb"
store SQLSTRINGCONNECT(;
'DBQ='+lcmdb+';'+;
'Driver={Microsoft Access Driver (*.mdb)}');
TO gnConnHandle
=sqlexec(gnConnHandle,"select Instruct.Ship_Via from Instruct;","lstcsnum")
Endproc

&& Figure 2.
*Purpose: for every record that is carried via an odbc *script, procedure Ship_Via is called and will create an *additional link which will &&display/view the shipping *instructions for each/every package.

Procedure SelectorForm()
back_to=SELECT() && current work area

oForm = createobject('SelectorForm')
oForm.Show

Define class SelectorForm as Form
DataSession = 2 && Private data session
Caption='Shipping Instructions'
ControlBox= .f.
BorderStyle=1
Height=300
Width=200
WindowType=1
Add object SelectorListBox as listbox with ;
Left=0, Top=0,Height=300,Width=200

Procedure SelectorListBox.Init()
lcmdb="C:\ASCENT\ODBCLINK\nonnorm.mdb"
store SQLSTRINGCONNECT(;
'DBQ='+lcmdb+';'+;
'Driver={Microsoft Access Driver (*.mdb)}');
TO gnConnHandle
=sqlexec(gnConnHandle,"select Instruct.Ship_Via from Instruct;","lstcsnum")

WITH THIS
.ROWSOURCETYPE = 3
.ROWSOURCE = 'Instruct.Ship_Via into cursor lstCsnum'
.COLUMNCOUNT=1
.COLUMNLINES = .T.
.COLUMNWIDTHS = 75
ENDWITH
ENDPROC
Enddefine

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top