Adding items to a list box

R

Ryan W

I have a frmMain that has several yes/no checkboxes on it. How would I be
able to take the items that the user selects and populate a listbox/textbox
on another form.

What I am trying to do is create a check form that has all the selections
that the user has entered. A way to check and ensure the data is accurate
before moving to the next record.

Possible?
Thanks in advance!
 
J

John Nurick

Assuming that the checkboxes are called ckSomething, ckSomethingElse,
etc., you could use code along these lines in the form's BeforeUpdate
event procedure. If you need something fancier than a messagebox, you
can pass strSelection to a form by using the OpenArgs argument of
DoCmd.OpenForm, and retrieve it in the form's Open event procedure.


Dim strSelections As String

If Me.ckSomething Then
strSelections = strSelections & "Something" & vbCrLf
End If
If Me.ckSomethingElse Then
strSelections = strSelections & "Something Else" & vbCrLf
End If
...

If MsgBox "You have selected " & vbCrLf & vbCrLf _
& strSelections & vbCrLf & vbCrLf & "Is that correct?", _
& vbOkCancel & vbQuestion, "Confirm selection" _
<> vbOK Then
Cancel = True
End If
 
Top