VB to Access DataAdapter error

Sam_R

New member
Joined
Jan 17, 2008
Messages
2
Programming Experience
Beginner
I am relatively new to Visual Basic and this is the first time I have tried to use VB.Net to connect to an Access database. I am using Visual Basic in Visual Studio.Net 2003 with the .Net Framework 1.1 and Access 2003. What I am trying to create are two forms that connect to different tables in the same database. Specifically, I have a "Create User Accounts" form that connects to the tblAccounts in Access and a "View Records" form that connects to a tblPrimary in the same Access file. I used the wizards to create an OLE Database Connection (Microsoft Jet 4.0 provider), DataAdapter (using SQL query statements), and a DataSet for the "View Records" form. This worked without throwing any errors. However, when I followed exactly the same steps for the "Create User Accounts" form the DataAdapter will not connect. It reports:

The wizard detected the following problems when trying to configure the data adapter "OleDbAdapter1".

Details:
Generated SELECT statement.

The LEVEL clause includes a reserved word or argument that is misspelled or missing, or the punctuation is incorrect.


I do not see how there can be any misspellings or punctuation errors when I used the wizards to generate the query. The query is pretty simple:

SELECT tblAccounts.*
FROM tblAccounts


Has anyone come across a similar situation? Is there something different a programmer must do to connect two different forms to two different tables in the same database?
 
Last edited:
failing that, just a thought, you may have an invalid column name in your table. Column names such as Name you can't use * for, you would have to put in brackets like so;
SELECT AccountID, [Name] FROM tblAccounts

Can you list your tblAccounts column names?
 
The error is gone!

Thank you Arg81! As soon as you mentioned "invalid column name," I knew that had to be it. I looked back in the Access file, and sure enough, in the table there was a field named "level". I changed it to "userlevel" and tried to build the DataSet again. The connection was created with no problem. It was right in front of me all along. Again, thanks. I probably never would have found it without your help.
 
Back
Top