I have the following SQL statement giving me a run time 3131 error. I can't for the life of me see what is wrong. If I run the sql in a query it works fine. the debug statement at the bottom returns:
The SQL statement is as follows:
[/COLOR]
It fails on the highlighted line
Code:
SELECT tblRapidPrototyping.[RapidProtoID], Contacts.[First Name], Contacts.[E-mail Address], tblCompanies.[CompanyName], tblRapidPrototyping.[CubicInch], tblRapidPrototyping.[BuildTimehr], tblRapidPrototyping.[BuildTimeMin], tblRapidPrototyping.[DateRequested], tblRapidPrototyping.[QuoteAmount], tblRapidPrototyping.[MaterialCost], tblRapidPrototyping.[SetupCost], tblRapidPrototypeBuildMaterial.[ConsumableName], tblBOM_Master.[BOMDescription] FROM [tblCompanies] INNER JOIN [tblBOM_Master] INNER JOIN [Contacts] INNER JOIN [tblRapidPrototyping] ON Contacts.[ID] = tblRapidPrototyping.[ContactID] ON tblBOM_Master.[BOMID] = tblRapidPrototyping.[BOMID] ON tblCompanies.[CompanyID] = tblRapidPrototyping.[CompanyID] AND tblCompanies.[CompanyID] = Contacts.[CompanyID] INNER JOIN tblRapidPrototypeBuildMaterial INNER JOIN tblProtoJobConsumables ON tblRapidPrototypeBuildMaterial.[BuildMaterialID] = tblProtoJobConsumables.[BuildMaterialID] ON tblRapidPrototyping.[RapidProtoID] = tblProtoJobConsumables.[RapidProtoID] WHERE
tblRapidPrototyping.[RapidProtoID]= 104 ;
The SQL statement is as follows:
Code:
strSQL = "SELECT tblRapidPrototyping.[RapidProtoID], Contacts.[First Name], Contacts.[E-mail Address], " & _
"tblCompanies.[CompanyName], tblRapidPrototyping.[CubicInch], tblRapidPrototyping.[BuildTimehr], " & _
"tblRapidPrototyping.[BuildTimeMin], tblRapidPrototyping.[DateRequested], tblRapidPrototyping.[QuoteAmount], " & _
"tblRapidPrototyping.[MaterialCost], tblRapidPrototyping.[SetupCost], tblRapidPrototypeBuildMaterial.[ConsumableName], " & _
"tblBOM_Master.[BOMDescription] " & _
"FROM tblCompanies INNER JOIN tblBOM_Master INNER JOIN Contacts INNER JOIN tblRapidPrototyping " & _
"ON Contacts.[ID] = tblRapidPrototyping.[ContactID] " & _
"ON tblBOM_Master.[BOMID] = tblRapidPrototyping.[BOMID] " & _
"ON tblCompanies.[CompanyID] = tblRapidPrototyping.[CompanyID] " & _
"AND tblCompanies.[CompanyID] = Contacts.[CompanyID] " & _
"INNER JOIN tblRapidPrototypeBuildMaterial INNER JOIN tblProtoJobConsumables " & _
"ON tblRapidPrototypeBuildMaterial.[BuildMaterialID] = tblProtoJobConsumables.[BuildMaterialID] " & _
"ON tblRapidPrototyping.[RapidProtoID] = tblProtoJobConsumables.[RapidProtoID] " & _
"WHERE tblRapidPrototyping.[RapidProtoID]= " & Forms!frmRapidPrototyping!txtRapidProtoID & " ; "
Debug.Print strSQL
[COLOR=red]Set rst = db.OpenRecordset(strSQL, dbOpenDynaset) [/COLOR]
[COLOR=black]
It fails on the highlighted line
Last edited: