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

Posted on 2007-08-02
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
    LVL 14

    Accepted Solution

    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


    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

    Glad to help you. :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now