I have an Access 2013 database. It has several tables, one of which is called "Aircraft". In that table, there are several fields, two of which are "Airframe Number" (unique identifier) and "Complete?" (yes/no checkbox). I know that there should not be spaces or punctuation used in field names but the reason for that is historical and not something that can be easily changed right now without a major rewrite.
I want to make a form that will allow me to select a specific airframe number and toggle the yes/no condition. I copied a form that worked, that allowed airframe selection and then caused the selected airframe details to display as a result of a button click. I intended to use the existing airframe selection mechanism (which works fine), then having selected the right 'frame, modify the (exiting) button function so that it changed the state of the "Completed?" field, so in essence, I all I needed to do is replace working code behind the button with new code that will change the "Completed?" field to opposite of what it already is, when the button is clicked
I placed the following code behind the button:
...but it responds with "Too few Parameters. Expected 1".
I understand that this error happens when the field name(s) in the command do not match the table field name(s), i.e. a field name in the command is wrong or perhaps the table is missing the field altogether.
The table "Aircraft" definately has the columns "Completed?" and "Airframe Number" and it's also definately called "Aircraft", so I'm at a bit of a loss as to whats going on (I checked the spelling). I have tried a number of different " and ' combinations, in case its the space or punctuation in the field names that is the problem, to no avail. Any help would be much appreciated.
Cheers
Jim
I want to make a form that will allow me to select a specific airframe number and toggle the yes/no condition. I copied a form that worked, that allowed airframe selection and then caused the selected airframe details to display as a result of a button click. I intended to use the existing airframe selection mechanism (which works fine), then having selected the right 'frame, modify the (exiting) button function so that it changed the state of the "Completed?" field, so in essence, I all I needed to do is replace working code behind the button with new code that will change the "Completed?" field to opposite of what it already is, when the button is clicked
I placed the following code behind the button:
Code:
Private Sub Select_Click()
On Error GoTo Err_Select_Click
CurrentDb.Execute "UPDATE Aircraft SET [Completed?]= Not [Completed?] WHERE [Airframe Number] = '" & Me.[Airframe Number] & "'"
Exit_Select_Click:
Exit Sub
Err_Select_Click:
MsgBox Err.Description
Resume Exit_Select_Click
End Sub
...but it responds with "Too few Parameters. Expected 1".
I understand that this error happens when the field name(s) in the command do not match the table field name(s), i.e. a field name in the command is wrong or perhaps the table is missing the field altogether.
The table "Aircraft" definately has the columns "Completed?" and "Airframe Number" and it's also definately called "Aircraft", so I'm at a bit of a loss as to whats going on (I checked the spelling). I have tried a number of different " and ' combinations, in case its the space or punctuation in the field names that is the problem, to no avail. Any help would be much appreciated.
Cheers
Jim