Sometime ago some of you helped me figuring out how I should insert and update some values in my db. At the end it functioned perfectly. Recently I deinstalled Access 2013 and installed 2007 because of the unavailibility of certain functions. I dont know if this caused my following issue but Access gives an error (the code that generates the error is bold and underlined). It gives Error code 3061, not enough parameters. The expected number is 1.
I didn't change any of the controls used for this code.
I hope someone is able to help me figure out where it goes wrong.
I didn't change any of the controls used for this code.
Code:
Dim myDb2 As Database
Dim rst2 As Recordset
Set myDb2 = CurrentDb
[B][U]myDb2.Execute ("INSERT INTO tblActionsTaken (LastTimeBuy, ActionDate, ActionDetails) VALUES( " & (Me.lstLastTImeBuy = "Yes") & "," & Me.txtActionDate & ",'" & Me.txtActionDetails & "') ")[/U][/B]
Set rst2 = myDb2.OpenRecordset("SELECT @@Identity as SelectedID")
SelectedID = rst2.Fields(0)
myDb2.Execute ("UPDATE tblSubComponent Set ActionID=" & SelectedID & " WHERE SubComponentPN= '" & Me.lstActionSelectPart & "'")
Set rst2 = Nothing
Set myDb2 = Nothing
I hope someone is able to help me figure out where it goes wrong.