Dear Friends
I am stuck again in the following code. the run-time error code is 3265.
I am stucking in "Set qryDef = CurrentDb.QueryDefs(strQueryName)".
Can somebody check my error?
thanks in advance.
I am stuck again in the following code. the run-time error code is 3265.
I am stucking in "Set qryDef = CurrentDb.QueryDefs(strQueryName)".
Can somebody check my error?
thanks in advance.
Code:
Option Compare Database
Private Sub Calculate_Click()
Dim strLDOMonth As String
Dim QueryName As String
Dim qryDef As DAO.QueryDef
Dim strSelect As String
strLDOMonth = Me.LDOMth1
QueryName = "MonthlyBalanceQ1"
strNewT = newTable
strQueryName = QueryName
strSelect = "SELECT " & strLDOMonth & " AS Period,"
strSelect = strSelect & " BalanceStockMain.Stock, alanceStockMain.ITEM, BalanceStockMain.BAL FROM BalanceStockMain;"
Set qryDef = CurrentDb.QueryDefs(strQueryName)
qryDef.SQL = strSelect
qryDef.Close
DoCmd.OpenQuery QueryName, acNormal, acEdit
End Sub