G
Guest
I am working with a sql statement that works fine as a query. We are trying
to pull up information on a subform after the user enters criteria. Once we
try to put it into VBA to do this, we get errors. This is our vba code:
Private Sub cmdView_Click()
Dim strSelectSQL As String
strSelectSQL = "SELECT tblPanelJob.Operation,
tblPanelJobDetail.OperationDetail,tblResults.date," & _
"tblResults.day, tblResults.Shift, tblResults.panels FROM " & _
"(tblPanelJob INNER JOIN tblPanelJobDetail ON
tblPanelJob.OpID=tblPanelJobDetail.OpID)" & _
"INNER JOIN tblResults ON (tblPanelJob.OpID=tblResults.OpID) AND " & _
"(tblPanelJobDetail.OpNum=tblResults.OpNum)WHERE " & _
"tblPanelJob.Operation= " & cboOperation.Value & " AND
tblPanelJobDetail.OperationDetail = " & _
cboOperationDetail.Value & " AND tblResults.[date] = " & txtDate.Value
CurrentDb.Execute (strSelectSQL)
frmCheckSub.Requery
End Sub
When we get the error and click on Debug, the CurrentDb.Execute line is what
is actually highlighted. to start with, I thought maybe there was a problem
with the SQL stmt, but once we got it working as a query, I figure that's not
the case.
Anyone have any suggestions? Help is greatly appreciated!
thanks!
Seren
to pull up information on a subform after the user enters criteria. Once we
try to put it into VBA to do this, we get errors. This is our vba code:
Private Sub cmdView_Click()
Dim strSelectSQL As String
strSelectSQL = "SELECT tblPanelJob.Operation,
tblPanelJobDetail.OperationDetail,tblResults.date," & _
"tblResults.day, tblResults.Shift, tblResults.panels FROM " & _
"(tblPanelJob INNER JOIN tblPanelJobDetail ON
tblPanelJob.OpID=tblPanelJobDetail.OpID)" & _
"INNER JOIN tblResults ON (tblPanelJob.OpID=tblResults.OpID) AND " & _
"(tblPanelJobDetail.OpNum=tblResults.OpNum)WHERE " & _
"tblPanelJob.Operation= " & cboOperation.Value & " AND
tblPanelJobDetail.OperationDetail = " & _
cboOperationDetail.Value & " AND tblResults.[date] = " & txtDate.Value
CurrentDb.Execute (strSelectSQL)
frmCheckSub.Requery
End Sub
When we get the error and click on Debug, the CurrentDb.Execute line is what
is actually highlighted. to start with, I thought maybe there was a problem
with the SQL stmt, but once we got it working as a query, I figure that's not
the case.
Anyone have any suggestions? Help is greatly appreciated!
thanks!
Seren