Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-Time Error Message 3061

Status
Not open for further replies.

claskew

Technical User
Feb 23, 2011
21
US
Receiving error message 3061 when trying to submit changes. When I hit the Debug button, it goes to the below highlighted code:

End If
' execute sql to update record in Tbl_PubData using form data
' PK_pubData, PrintID, PK_pubData, PubType, PubSubType, PubSubTypeOther, Frequency, FrequencyDate, Division, HighProfile, FK_Lifecycle, FK_PubWeb, ProjectLead, LeadEditor, LeadDesigner, EconEditor, AudLoc, ExtAudType, ExtAudOther, Client
Dim PubDataSQL As String
If IsNull(TextComments) Then
TextComments = ""
End If
PubDataSQL = "UPDATE Tbl_PubData SET " & _
"PubName = '" & Replace(TextPubName, "'", "''") & "', " & _
"FK_PubType = '" & ComboPubType & "', " & _
"FK_PubSubType = '" & ComboPubSubType & "', " & _
"Spanish = " & CheckSpanish & ", " & _
"PubSubTypeOther = '" & Replace(TextPubSubTypeOther, "'", "''") & "', " & _
"FK_Frequency = '" & ComboFreq & "', " & _
"FrequencyCycle = '" & ComboFreqCyc & "', " & _
"FK_Division = '" & ComboDiv & "', " & _
"HighProfile = '" & ComboHighProfile & "', " & _
"FK_ProjectLead_Lkp_DeptStaff = '" & ComboProjectLead & "', " & _
"FK_LeadEditor_Lkp_DeptStaff = '" & ComboLeadEditor & "', " & _
"FK_LeadDesigner_Lkp_DeptStaff = '" & ComboLeadDesigner & "', " & _
"FK_EconEditor_Lkp_EconEditors = '" & ComboEconEditor & "', " & _
"FK_Client_Lkp_contacts = '" & ComboClient & "', " & _
"Comments = '" & Replace(TextComments, "'", "''") & "', " & _
"PubCost = '" & TextPubCost & "', " & _
"FK_LeadWebDesigner_Lkp_DeptStaff = '" & ComboLeadWDesigner & "', " & _
"FK_LeadWebEditor_Lkp_DeptStaff = '" & ComboLeadWEditor & "' " & _
"WHERE PK_PubData = " + LkpPK_PubData + ";"
[highlight]CurrentDb.Execute PubDataSQL[/highlight]
End Sub
 
I believe it's an issue with your SQL code.

Can you put the SQL into an empty Access query, and see if it throws any errors? Then if it does, fix in the query, and then re copy/paste into the VBA....

Another way of getting the SQL code to look at before it runs (probably the easiest way) is to add in this line of code:
Code:
Debug.Print PubDataSQL
Immediately above the line, CurrentDb.Execute PubDataSQL

That'll give you a cleaner bit of SQL to look at, so you can more easily find the specific problem.
 
How are ya claskew . . .
Code:
[blue]Replace: "WHERE PK_PubData = " + LkpPK_PubData + ";"
With   : "WHERE PK_PubData = " [purple][b]&[/b][/purple] LkpPK_PubData [purple][b]&[/b][/purple] ";"[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thanks for your help. I appreciate it. It worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top