spikepl
Eledittingent Beliped
- Local time
- Today, 23:56
- Joined
- Nov 3, 2010
- Messages
- 6,142
I have a form and a continuous subform. It is for a multiple-choice selection, and the subform displays all the available choices just fine. A choice is selected by clicking on a checkbox in the desired line.
I have the code below, so that when a choice is made (or remade) by clicking on a checkbox, all other checkboxes get deselected. This works fine in the subform when used standalone. Nothing happens when I use the main form with this subform embedded. The code does get executed, but obviously I am missing something, because now (in the embedded form) I can select more than one choice.
I don't really care how I accomplish what I want - if you have a better suggestion then please come forward
Update:
The .edit -bit is never reached when the form is embedded, because the bookmark of current line never matches the remembered bookmark (marking the line where I clicked). Why not, when it works just fine when the subform is run standalone ?
I have the code below, so that when a choice is made (or remade) by clicking on a checkbox, all other checkboxes get deselected. This works fine in the subform when used standalone. Nothing happens when I use the main form with this subform embedded. The code does get executed, but obviously I am missing something, because now (in the embedded form) I can select more than one choice.
Code:
Private Sub chbChoiceSelected_AfterUpdate()
Dim rst As DAO.Recordset
Dim myBookmark As String
Dim tempBookmark As String
Set rst = Me.RecordsetClone
myBookmark = Me.Recordset.Bookmark
With rst
.MoveFirst
Do While Not .EOF
tempBookmark = .Bookmark
If tempBookmark = myBookmark Then
Else
.Edit
!ChoiceSelected = False
.Update
End If
.MoveNext
Loop
.Bookmark = myBookmark
End With
Set rst = Nothing
End Sub
Update:
The .edit -bit is never reached when the form is embedded, because the bookmark of current line never matches the remembered bookmark (marking the line where I clicked). Why not, when it works just fine when the subform is run standalone ?
Last edited: