?
Solved

Trying to create a querydef in an access 2000 database with vb.net

Posted on 2005-05-10
3
Medium Priority
?
272 Views
Last Modified: 2008-02-26
    Dim acapp As New Access.Application
        Dim strName As String = "Query1"
        Dim strSQL As String = "SELECT Div, ReportDate, theDesc, Sum(Unit) AS SumOfUnit, Sum(Total) AS SumOfTotal " & _
        "FROM unionReconciliationPKMSWSSR_Report " & _
        "GROUP BY Div, ReportDate, theDesc " & _
        "HAVING (((ReportDate) Between #4/25/2005# And #5/1/2005#)) " & _
        "ORDER BY Div, ReportDate, theDesc;"

        Dim qdfTemp As DAO.QueryDef


        With acapp
            .OpenCurrentDatabase(cdir & "\WSSR_PKMS_Balancing.mdb")

            qdfTemp = DAO.Database.CreateQueryDef()

            qdfTemp.Name = strName
            qdfTemp.SQL = strSQL

            DAO.QueryDefs.Append(qdfTemp)

            CreateNewQuery = qdfTemp

        End With

I am getting the following error:

reference to a non-shared member requires an object reference


0
Comment
Question by:dressman
  • 2
3 Comments
 
LVL 34

Assisted Solution

by:Sancler
Sancler earned 500 total points
ID: 13973413
What is

CreateNewQuery?

I do not recall it but, just from the code, it looks like it might be a member of acapp.  In which case it probably needs to be

.CreateNewQuery = qdfTemp

Just a guess.

Roger
0
 
LVL 15

Accepted Solution

by:
will_scarlet7 earned 500 total points
ID: 14195296
What line is giving you the error?
I don't yet do .net but from what I have heard it does not support DAO, so it could be that your "DAO.QueryDef" is causing the trouble.
0
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 14202211
dressman,
    Since you graded this question with a "C" I assume that you did not get a satisfactory Answer. For future questions, please feel free to give continuing feedback to you initial question and the experts' suggestions, that way we can work with you to get a solution that will hopefully end up working properly for your needs. In the link below we are working with another person on a similar question, and you might find the conclusion (when we reach it) even more helpful then what we have been able to post here.

Looking to help...

Sam

http://www.experts-exchange.com/Databases/MS_Access/Q_21454698.html
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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.
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

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