HLEmerson
HLEmerson

Reputation: 27

Code for button on form to update table in ms access

I'm trying to create a simple form using unbound combo boxes and a button that updates a table when clicked. I have already created another form that is similar to this that works great, so I tried to replicate it using the appropriate fields, but I get an error message- Run-time error '3061: Too few parameters. Expected 1.

The only two fields on the form are FrameID and FrameLocation and the button is MoveFrame. The table to be updated is StockFrames.

This is the code I have on the on-click event on the button:

     Private Sub MoveFrame_Click()
     CurrentDb.Execute "UPDATE StockFrames SET frameLocation = " & Me.frameLocation & _" WHERE FrameID = " & Me.FrameID 
     Me.frameLocation.Value = Null 
     Me.FrameID.Value = Null 
     End Sub

I appreciate any help anyone can offer. I'm very new to MS Access. If there is any other information that you need as far as the property settings, please let me know. I'm eager to learn and to get this form working properly.

Thank you.

Upvotes: 0

Views: 612

Answers (1)

June7
June7

Reputation: 21370

If frameLocation is a text field, parameter needs apostrophe delimiters:
='" & Me.frameLocation & "' WHERE.

Remove that underscore character.

Date/Time fields use # delimiter.

Upvotes: 1

Related Questions