runtime 3131 - please help! (1 Viewer)

Sketchin

Registered User.
Local time
Yesterday, 18:51
Joined
Dec 20, 2011
Messages
575
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:
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]
[/COLOR]

It fails on the highlighted line
 
Last edited:

pr2-eugin

Super Moderator
Local time
Today, 02:51
Joined
Nov 30, 2011
Messages
8,494
It seems you are performing several JOINS but it does not form a sequence Try pasting the Debug.Print statement on a SQL view of a Query it will auto insert some parentheses. Or slowly work through the joins perform the final outer then the next so on..
 

Sketchin

Registered User.
Local time
Yesterday, 18:51
Joined
Dec 20, 2011
Messages
575
I deleted those parenthesis....whoops!

Thanks for the help!
 

Users who are viewing this thread

Top Bottom