I'm not sure where you are trying to use the 'afterupdate' expression that
you posted, but here is how to put code on an event such as AfterUpdate for
a checkbox control.
Open the form in design view. Click on the checkbox control. Click on the
Properties icon in the toolbar. Click on the Event tab. Go to the After
Update box, select [Event Procedure] from the dropdown list, click on the
three-dot button at far right side of the box, and select Code Window (if
asked). You'll then see a screen with three lines (second one will be blank)
[note that checkboxname will be replaced by the actual name of the checkbox
control]:
Private Sub checkboxname_AfterUpdate()
End Sub
In place of the blank line, put the code that you posted earlier:
Dim I As Integer, dataprinted As Variant
With Assistant.NewBalloon
.Heading = "Regional Sales Data"
.Text = "Select the region(s) you want to print."
For I = 1 To 3
.Checkboxes(I).Text = "Region " & I
Next
.Button = msoButtonSetOkCancel
If .Show = msoBalloonButtonOK Then
dataprinted = 0
For I = 1 To 3
If .Checkboxes(I).Checked = True Then
' Code to print region data.
dataprinted = dataprinted + 1
MsgBox "Region " & I & " data printed."
End If
Next
If dataprinted = 0 Then MsgBox "No data printed."
End If
End With
Save the form.
--
Ken Snell
<MS ACCESS MVP>
colleen medin said:
Read the help on afterupdate & find myself in over my head.
More help would be appreciated.
The way i understand it when i create a balloon with check boxes. Like the
code below.
I should also insert a line: assistant.afterupdate = "[more code]"
then when the operator checks a box in the balloon the 'more code' routine
gets controll.
Let me know. TIA
BTW you have been a great help.
Ken Snell said:
Put that code in the event procedure for the AfterUpdate event for the
checkbox.