Why is the query that I made in access not working from my VB.NET app?

Posted on 2007-08-02
Medium Priority
Last Modified: 2010-04-23
VS 2005

I am creating an application that pulls data out of an Access database file.  I am using the .NET OLEDB data provider to do this.  I created a fairly complex query using the designer in Access.  I then switched to the SQL view and cut and past the query into my application that I am developing.  I am getting errors in my application.  The queries are large so I've been testing pieces of them but getting inconclusive results.  Sometimes it looks like there might be key words in my query, other times it looks like the joins have syntax errors in them.

Is there a difference between the query syntax used in Access and the query syntax I should use from my app?


Question by:Todd_Anderson
  • 2
LVL 14

Accepted Solution

chinu1310 earned 1000 total points
ID: 19618671
Hi Todd,

Basically you have to take care of the brackets and single quotes etc stuff when you are writing your query in your application.

Can you post some query and some error so we can have more idea.

Author Comment

ID: 19627751

Thanks for the suggestion.  You were right.  I added brackets around all table and field names and replaced # signs with ' around my dates and everything worked perfectly.

LVL 14

Expert Comment

ID: 19627767
Glad to help you. :)

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question