I am building a MS Access database and I cannot find a solution to my issue anywhere. All I want to do is trigger an update to my table using SQL code upon clicking a button, however, each time I try to run this code I get the error: "Run time error 3061, Too few parameters. Expected 1". The naming of all the tables and fields I call in my SQL code is correct. I copy/pasted the SQL string from my debug print into a query builder and it worked without issue. My code is:
Private Sub cmdAddRev_Click()
Dim compNum As String
Dim docPath As String
Dim filePath As String
Dim lastRev As Integer
Dim updateRev As Integer
Dim sqlStr As String
compNum = Me.cboRevSelection.Value
docPath = Me.tboRevDocLoc.Value
filePath = Me.tboRevFileLoc.Value
lastRev = DLookup("numLastRev", "tblComponents", "num = [Forms]![frmRevisor]![cboRevSelection]")
updateRev = lastRev + 1
sqlStr = " UPDATE tblComponents "
sqlStr = sqlStr & " SET numLastRev = " & updateRev
sqlStr = sqlStr & " WHERE num = [Forms]![frmRevisor]![cboRevSelection] "
CurrentDb.Execute (sqlStr) 'this line is flagged when the error happens
Debug.Print sqlStr
End Sub