Hi All,
I am getting the above error when I run the following code.
Dim db As DAO.Database
Dim strsql As String
Dim rs1 As DAO.Recordset
Set db = CurrentDb()
strsql = strsql & "SELECT Last(tblPOHeader.PODate) AS LastOfPODate, tblPOLines.StockCode, Sum(tblPOLines.Quantity) AS SumOfQuantity, DateSerial(Year(Date()),Month(Date())-3,1) AS CfwdDate"
strsql = strsql & "FROM tblPOHeader INNER JOIN tblPOLines ON tblPOHeader.PONo = tblPOLines.POHeaderID"
strsql = strsql & "GROUP BY tblPOLines.StockCode"
strsql = strsql & "HAVING (((Last(tblPOHeader.PODate))<=[forms]![frmEOM]![txtDateEOQ]));"
Set rs1 = db.OpenRecordset(strsql)
rs1.MoveFirst
Do Until rs1.EOF
The code stops on the line highlighted in red.I'm sure it is probably a punctuation problem but I can't see it. Any ideas anyone?
I am getting the above error when I run the following code.
Code:
#
Dim strsql As String
Dim rs1 As DAO.Recordset
Set db = CurrentDb()
strsql = strsql & "SELECT Last(tblPOHeader.PODate) AS LastOfPODate, tblPOLines.StockCode, Sum(tblPOLines.Quantity) AS SumOfQuantity, DateSerial(Year(Date()),Month(Date())-3,1) AS CfwdDate"
strsql = strsql & "FROM tblPOHeader INNER JOIN tblPOLines ON tblPOHeader.PONo = tblPOLines.POHeaderID"
strsql = strsql & "GROUP BY tblPOLines.StockCode"
strsql = strsql & "HAVING (((Last(tblPOHeader.PODate))<=[forms]![frmEOM]![txtDateEOQ]));"
Set rs1 = db.OpenRecordset(strsql)
rs1.MoveFirst
Do Until rs1.EOF
Code:
#
Last edited: