I am trying to retrieve text from a textbox and store it into a table. I am getting a Too Few Parameters error and I can't seem to find a way to fix it. I've tried all sorts of suggestions on Google but it doesn't seem to be working.
The problem occurs with the 'Audit_Scope' parameter. If I copy+paste the strSQL into SQL Server, it works perfectly. However, if I try to copy+paste it into Access Query, it keeps prompting me for the dbo_tbl_Audit.Audit_Scope.
Below are two different versions of the code that doesn't work
The problem occurs with the 'Audit_Scope' parameter. If I copy+paste the strSQL into SQL Server, it works perfectly. However, if I try to copy+paste it into Access Query, it keeps prompting me for the dbo_tbl_Audit.Audit_Scope.
Below are two different versions of the code that doesn't work
Code:
Private Sub btnUpdateScope_Click()
Dim Audit_ID As Variant
Dim Scope As Variant
Audit_ID = Me.Audit_ID
Scope = Forms!subfrmEditAudit.Audit_Scope
strSQL = "UPDATE dbo_tbl_Audit SET dbo_tbl_Audit.Audit_Scope= """ & Me.Audit_Scope & """ WHERE Audit_ID = " & Audit_ID & ""
Debug.Print strSQL
CurrentDb.Execute strSQL, dbFailOnError Or dbSeeChanges
MsgBox "The scope has been updated."
Me.Requery
End Sub
Code:
Private Sub btnUpdateScope_Click()
Dim Audit_ID As Variant
Dim Scope As Variant
Audit_ID = Me.Audit_ID
Scope = Me.Audit_Scope
strSQL = "UPDATE dbo_tbl_Audit SET dbo_tbl_Audit.Audit_Scope= '" & Scope & "' WHERE Audit_ID = " & Audit_ID & ""
Debug.Print strSQL
CurrentDb.Execute strSQL, dbFailOnError Or dbSeeChanges
MsgBox "The scope has been updated."
Me.Requery
End Sub