Link to home
Start Free TrialLog in
Avatar of dressman
dressman

asked on

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

    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


SOLUTION
Avatar of Sancler
Sancler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of will_scarlet7
will_scarlet7

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

https://www.experts-exchange.com/questions/21454698/MSAccess-Views-defintion-Text.html