Harry Paraskeva
Registered User.
- Local time
- Today, 13:05
- Joined
- Sep 8, 2013
- Messages
- 67
Having solved the issue of populating multiple comboboxes (see here), I have now run in another issue, which is how to delete the records in three comboboxes that are linked to multi-valued fields (MVFs) in the same table.
At the moment the solution I've tried and kinda works (sometimes it doesn't delete everything, hence the kinda) goes as such:
- I have three buttons with the following code:
If you noticed the lines
Me.Command1906.SetFocus
Call SendKeys(" ", True)
basically reference the next button that has the same code. The reason I had to do this is because it was throwing around errors about record locking or object not available when I tried to compile the code under a single button or at least I was probably not doing it right.
So the question is: Is it possible to do this with just one button, namely is it possible to delete all the records in three different multi-valued fields residing in the same table?
At the moment the solution I've tried and kinda works (sometimes it doesn't delete everything, hence the kinda) goes as such:
- I have three buttons with the following code:
Code:
Private Sub Command1903_Click()
On Error GoTo Rst_Err1
Me.{MVF to delete records}.RowSource = ""
Dim rst1 As DAO.Recordset
Set rst1 = Me.Recordset!{MVF to delete records}.Value
Do While rst1.EOF = False
rst1.Delete
rst1.MoveNext
Loop
Me.{MVF to delete records}.Enabled = False
Me.Command1906.SetFocus
Call SendKeys(" ", True)
Rst_Ext1:
On Error Resume Next
Set rst1 = Nothing
rst1.Close
Exit Sub
Rst_Err1:
MsgBox Err.Description
Resume Rst_Ext1
End Sub
If you noticed the lines
Me.Command1906.SetFocus
Call SendKeys(" ", True)
basically reference the next button that has the same code. The reason I had to do this is because it was throwing around errors about record locking or object not available when I tried to compile the code under a single button or at least I was probably not doing it right.
So the question is: Is it possible to do this with just one button, namely is it possible to delete all the records in three different multi-valued fields residing in the same table?