check boxes, eye dots ...

  • Thread starter Thread starter colleen medin
  • Start date Start date
C

colleen medin

Ref: office xp sp3

Would like to put up on the screen a window with several check box's or ...
.. The user would then mark the boxes appropriate to his request & then click
on next or ... . Then the vba program could process the request(s).

Seems access has this capability but I cant find it. TIA
 
Not sure what you cannot find? ACCESS has checkbox control, radio button
control, and toggle button control. Any of these could work for your
purposes. They can be used within an option group (which means only one can
be selected at a time) or as standalone controls (which means that any
number of them can be selected at one time).

VBA code would read the controls' values and do something with them. This is
pretty common stuff for ACCESS.
 
We currently have buttons in forms. We click on a button & a vba program
gets control. So what is the step/steps to get to checkbox control ... . TIA
 
To put checkbox controls on the form, open it in design view and drag
checkboxes onto the form. That is done just the same way as you did it when
the command buttons were added.

If you're wanting to know how to have VBA code do something with the
checkboxes' values, you'll need to tell me more about what your form is used
for and what is supposed to happen when a checkbox is checked.
--

Ken Snell
<MS ACCESS MVP>
 
Ok thanks for the tip. I did use help & found some help.

What we are trying to do is: modify parts of a users record.
Would like to present several check boxes which will fix parts of the users
record. ie a check box to change the zip code, a check box to change the
phone number... . Then when vba gets the click it can get the info from the
operator & modify the appropriate field of the users record ... .

I tried to follow the help for a check box but when they said click the
'field list' I got no response. So was unable to drag the field. :-(.
 
In VBA code, you could loop through the checkboxes, and then do things based
on the value of the checkbox:


If Me.Checkbox1.Value = True Then
' do something because the checkbox is checked
End If
If Me.Checkbox2.Value = True Then
' do something because the checkbox is checked
End If
If Me.Checkbox3.Value = True Then
' do something because the checkbox is checked
End If
If Me.Checkbox4.Value = True Then
' do something because the checkbox is checked
End If

etc.

--

Ken Snell
<MS ACCESS MVP>
 
Ok thanks that's a start. I assume one can execute vba code via the on click
property. What I am missing is how to make a box in a form with check boxes
in it. We already have a form with lots of command buttons. I tried to add
a check box in that form but I seems to be missing something. All I could
get is a check box all by itself. Help indicated clicking on the check box
tool. If I drew a box on the form all I got was a check box. Help also
indicated that for a bound object I should drag the field from the field
list. The field list was grayed out :-(. I must be missing some easy steps.
TIA
 
I'm not sure I'm fully understanding what you want here.

Do you want the checkboxes to be such that only one can be checked at a
time, and that if one is checked and you check a different one, the one that
was checked becomes unchecked? If yes, then what you want is an option group
(frame), in which you put checkboxes. There is a wizard for this; be sure
that the magic wand button is depressed, and then click on an option group
in the toolbox (square with XYZ at top) and then click on the form; the
wizard will guide you through it.

If you want each checkbox to be independent, but you want to draw a "box"
around all the checkboxes, then use the Rectangle control to make the 'box'.

--

Ken Snell
<MS ACCESS MVP>
 
Ok thanks for the info I was not aware how one starts the wizard.
I did find some code in help which does most of what i want.
However, this code must have the 'ok' button to invoke the vba code again.
What can i do to this code so that a single click in the checkbox will
invoke the vba code again? TIA

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
 
Put that code in the event procedure for the AfterUpdate event for the
checkbox.
 
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.
 
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.
 
Back
Top