troubleshooting Question

Using SQL statement in Visual Basic to query

Avatar of strongd
strongdFlag for United States of America asked on
Visual Basic ClassicMicrosoft Development
19 Comments1 Solution210 ViewsLast Modified:
I have a form, textbox, data control, a DBGrid control, and a command button.  I have the data control connected to a DBASE table, the DBGrid is connected with the data control to display the table in the grid.  I am trying to type the SQL statement into the textbox, then I press a button to query the table.  This isn't working
My table name is  MyTable.DBF
here is my statement
This go's into the textbox

SELECT FirstName
FROM MyTable

Button Code is
Event Click

Data1.RecordSource = Text1.text
Data1.Refresh

When I press my button, VB gets confused.  It doesn't understand.
Here is the message box I get....

Run-Time Error 3125
The database engine can't find "SELECT FirstName FROM MyTable"
Make sure it is a valid parameter or alias name, that it doesn't include invalid character or punctuation and that the name isn't too long.

I have tried quotes around the SQL statement but doesn't work either...
Please someone help.
Thanks
 
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 19 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 19 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros