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 unionReconciliationPKMSWSS R_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.CreateQueryDe f()
qdfTemp.Name = strName
qdfTemp.SQL = strSQL
DAO.QueryDefs.Append(qdfTe mp)
CreateNewQuery = qdfTemp
End With
I am getting the following error:
reference to a non-shared member requires an object reference
Dim strName As String = "Query1"
Dim strSQL As String = "SELECT Div, ReportDate, theDesc, Sum(Unit) AS SumOfUnit, Sum(Total) AS SumOfTotal " & _
"FROM unionReconciliationPKMSWSS
"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.CreateQueryDe
qdfTemp.Name = strName
qdfTemp.SQL = strSQL
DAO.QueryDefs.Append(qdfTe
CreateNewQuery = qdfTemp
End With
I am getting the following error:
reference to a non-shared member requires an object reference
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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