silentwolf
Well-known Member
- Joined
- May 14, 2008
- Messages
- 1,216
- Office Version
- 2016
Hi guys,
Not sure if the information I am giving is enough for you to help me.
This is a code I try to run but I am getting an runtime Error 3075 missing element or in query it is in the WHERE Clause..
does anyone of you guys know where I this is wrong?
Thanks
Not sure if the information I am giving is enough for you to help me.
This is a code I try to run but I am getting an runtime Error 3075 missing element or in query it is in the WHERE Clause..
Code:
Private Sub btnTest_Click()
Dim strSQL As String
Dim strSQLTeil As String
Dim Dateiname As String
Select Case Me!fraStatus
Case 1
strSQLTeil = "tblStatus.staID=1"
Case 2
strSQLTeil = "tblStatus.staID=2"
Case Else
strSQLTeil = "tblStatus.staID>0"
End Select
strSQL = "SELECT tblObjekte.objID, IIf([kunFirma] Is Null,[kunVorname] & "" "" & [kunNachname],[kunFirma]) AS Kontakt, tblObjekte.objAdresse, tblObjekte.objOrt, tblStatus.staID " & _
"FROM tblStatus INNER JOIN (tblKunden INNER JOIN tblObjekte ON tblKunden.kunID = tblObjekte.objKunIDRef) ON tblStatus.staID = tblObjekte.objStatIDRef " & _
"WHERE [COLOR=#ff0000](((tblObjekte.objID)=[Formulare]![frmObjektAuswahl]![cboTest]) AND " & strSQLTeil[/COLOR]
CurrentDb.QueryDefs("qryObjektTest").SQL = strSQL
DoCmd.OpenQuery "qryObjektTest"
End Sub
does anyone of you guys know where I this is wrong?
Thanks