Hello,
I have searched online for a solution to this and haven't found anyone with my exact issue. I have a database that has a linked table from another Access database named BuildSheetFolderList. I can run queries off that table in the query builder all day long with no issues. But when I try to use the same SQL code the query builder produced in VBA code, I get the following error:
Following is the portion of code that crashes and is triggered when a toggle button is clicked.
Any help or pointers where to look is greatly appreciated. If I didn't include any crucial information forgive me a let me know. Thanks.
I have searched online for a solution to this and haven't found anyone with my exact issue. I have a database that has a linked table from another Access database named BuildSheetFolderList. I can run queries off that table in the query builder all day long with no issues. But when I try to use the same SQL code the query builder produced in VBA code, I get the following error:
Code:
?errors(0).Number
3078
?errors(0).Description
The Microsoft Access database engine cannot find the input table or query ''. Make sure it exists and that its name is spelled correctly.
?errors(0).Source
DAO.Database
Following is the portion of code that crashes and is triggered when a toggle button is clicked.
Code:
Private Sub lstBuildRequests_AfterUpdate()
Dim db As Database
Dim requestRST As DAO.Recordset2
Dim ActiveRequestsSQL As String
Set db = DBEngine(0)(0)
' When this is true, and ActiveRequestsSQL is assigned the SQL in the true part, it gives the above error when opening the recordset, as indicated below.
If Me.tglFSUArea Then
ActiveRequestsSQL = _
"SELECT BuildSheetFolderList.[FSU Area] AS REQ_DESC, " _
& "BuildSheetFolderList.[Pay Crew] AS PER_FULL_NM, " _
& "BuildSheetFolderList.[Work City], " _
& "BuildSheetFolderList.[Work Address] AS NOTES " _
& "FROM BuildSheetFolderList " _
& "WHERE (((BuildSheetFolderList.ID)=" & Me.lstBuildRequests.value & ")); "
Else
ActiveRequestsSQL = _
"SELECT dbo_BLD_REQ.BLD_REQ_ID, " _
& "dbo_BLD_REQ.REQ_DESC, " _
& "dbo_BLD_REQ.WRKSTN_QTY_CD, " _
& "dbo_V_DEHR_PERSON_DATA.PER_FULL_NM, " _
& "dbo_BLD_REQ.REQ_BLD_DT, " _
& "dbo_BLD_REQ.TRGT_BLD_DT, " _
& "dbo_BLD_REQ.ACTL_BLD_DT, " _
& "dbo_BLD_REQ.NOTES, " _
& "dbo_BLD_REQ.BLD_REQ_CMPLTN_DT, " _
& "dbo_BLD_REQ.BENTLEY_REQ_FLG " _
& "FROM ((dbo_BLD_REQ " _
& "LEFT JOIN dbo_BLD_REQ_STAT_HIST ON dbo_BLD_REQ.BLD_REQ_ID = dbo_BLD_REQ_STAT_HIST.BLD_REQ_ID) " _
& "LEFT JOIN dbo_BLD_REQ_WRKSTN ON dbo_BLD_REQ.BLD_REQ_ID = dbo_BLD_REQ_WRKSTN.BLD_REQ_ID) " _
& "LEFT JOIN dbo_V_DEHR_PERSON_DATA ON dbo_BLD_REQ.RQSTR_LOGIN_ID = dbo_V_DEHR_PERSON_DATA.PER_NETWRK_LOGIN_ID " _
& "WHERE (((dbo_BLD_REQ.BLD_REQ_ID)= " & listSelection & " ));"
End If
'This gives the '...cannot find the input table or query...'.
Set requestRST = db.OpenRecordset(ActiveRequestsSQL, dbOpenDynaset, dbSeeChanges)
End Sub
Any help or pointers where to look is greatly appreciated. If I didn't include any crucial information forgive me a let me know. Thanks.