AccessUser22
Technical User
I have a form set up which has three list boxes. The first list box lists a group of employees. The second lists the employees that the user selects, and the third lists the final selection the user makes. There are add and delete buttons on the form which allow the user to move employees from the first list to the second list. There are also buttons which will clear out the user selection and commit the selection to memory (the third list box).
This worked flawlessly in the past. However, the other day it started acting up on me. At the present I'm getting the following error.
Run-time Error -2147217900(80040e14)
Invalid SQL Statement;expected 'Delete', 'Insert','Procedure','Select', or 'Update'
The code I'm using comes straight out of a Microsoft Knowledge base article #209878
Private Sub cmdClear_Click()
Dim conn As ADODB.Connection
Dim MyRS As ADODB.Recordset
'Set up the connection and recordset.
Set conn = CurrentProject.Connection
Set MyRS = New ADODB.Recordset
'Open the Recordset
MyRS.Open "tblCorrespondenceList", conn, adOpenDynamic, adLockOptimistic
With MyRS
'Loop through all records and set the Yes-No_fld to "Yes".
Do While Not .EOF
.Fields("Yes-No_fld"
.Value = "Yes"
.Update
.MoveNext
Loop
End With
Set MyRS = Nothing
Set conn = Nothing
' make sure the list boxes have the current values.
Me.ListYes.Requery
Me.ListNo.Requery
End Sub
Right now the error is being generated when the recordset is opened and set to the tblCorrespondenceList.
I have no idea why this error is suddenly being generated. Any ideas would be greatly appreciated. Thanks.![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
This worked flawlessly in the past. However, the other day it started acting up on me. At the present I'm getting the following error.
Run-time Error -2147217900(80040e14)
Invalid SQL Statement;expected 'Delete', 'Insert','Procedure','Select', or 'Update'
The code I'm using comes straight out of a Microsoft Knowledge base article #209878
Private Sub cmdClear_Click()
Dim conn As ADODB.Connection
Dim MyRS As ADODB.Recordset
'Set up the connection and recordset.
Set conn = CurrentProject.Connection
Set MyRS = New ADODB.Recordset
'Open the Recordset
MyRS.Open "tblCorrespondenceList", conn, adOpenDynamic, adLockOptimistic
With MyRS
'Loop through all records and set the Yes-No_fld to "Yes".
Do While Not .EOF
.Fields("Yes-No_fld"

.Update
.MoveNext
Loop
End With
Set MyRS = Nothing
Set conn = Nothing
' make sure the list boxes have the current values.
Me.ListYes.Requery
Me.ListNo.Requery
End Sub
Right now the error is being generated when the recordset is opened and set to the tblCorrespondenceList.
I have no idea why this error is suddenly being generated. Any ideas would be greatly appreciated. Thanks.
![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)