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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Where from MS Access Boolean field

Status
Not open for further replies.

MikeMV

MIS
May 15, 2006
131
US
I am using VFP 9.0 SP2 and need select records based on an MS Access Boolean true/false record. I am stumped, I have tried many different ways using =0, =false, etc.

Is there a way to make this work?

I will greatly appreciate your feedback.
 
You would use true and false or you can use 1 and 0 or even you can use .T. and .F. (provided you do it parametric):

Code:
CLEAR all
lcMDB = 'c:\temp\northwind.mdb'
lnConnHandle = ;
	Sqlstringconnect("Driver={Microsoft Access Driver (*.mdb)};"+;
	"Uid=Admin;DBQ="+m.lcMDB)

TEXT TO lcSQL noshow
SELECT * FROM Products where (Discontinued=?m.State)
ENDTEXT

state = .T.
? SQLExec(m.lnConnHandle, m.lcSQL, 'result')
SQLDisconnect(0)

Select result
Browse

These are valid too:
Code:
SELECT * FROM Products where (Discontinued=true)
SELECT * FROM Products where (Discontinued=1)



Cetin Basoz
MS Foxpro MVP, MCP
 
Thanks a million, I was missing enclosing the (Discontinued=true) I had it as discontinued=true

 
It is not your fault, MS Access has a weird understanding of SQL:)

Cetin Basoz
MS Foxpro MVP, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top