Change value of checkbox at runtime (using VBA)

F

febad

Hello,

I will like to change the value of a check box at runtime. I have a
database with a field "multiple_print_select", which stores a value of
"1" when it is checked so that the record can be printed.

This allows only the records selected to be printed, but wen another
set of records are selected again, the previous selection are still
true, so the records are reprinted which I need to prevent.

So, I'm thinking of changing the value of the checkbox at runtime: For
instance, a VBA code that will set the value of the checkbox to "0" on
closing the report or a better way of doing this.

You help will be highly appreciated.

Regards,
febad
 
A

Albert D. Kallal

So, I'm thinking of changing the value of the checkbox at runtime: For
instance, a VBA code that will set the value of the checkbox to "0" on
closing the report or a better way of doing this.

I don't think that report closing time is a very good idea. it is possible
that the person spent the last four to five hours to phoning several people
on the phone, and gathering that list of selections that made taken a
significant amount of human labor to decide which were Eckerd's are to be
included in this report.

at think it's best to have a button on a form that prints the report, and
have a secondary button that you use when pressed is to clear the list out
so you can start a new. The problem is the user might print the report and
think the printer had paper in it, or the printer prints out that the paper
but has no toner. furthermore chest after you print a report and answer yes,
someone might walk in and say we need a few more names added to the report.

does as a general idea she make a separate option to clear out the selected
text boxes.

the code to turn off or deflect the check box is quite simple :

currentdb.Execute "update tblCustomers set MailTo = False where MailTo =
True"

you of course would put some code to prompt and asks the user if they really
want to do this, but the above will reset the check boxes for you.

you can see some screen shots of how I accomplish this for some of my
clients here:

http://www.kallal.ca/ridestutorial/quick/quick.htm
 
S

Steve

Hello Albert,

Could I get a copy of your Print Labels form in
http://www.kallal.ca/ridestutorial/quick/quick.htm. I really like how you
select the start position to print labels. Are those really optiom buttons?

Also in the picture above that you have a button with a calendar icon for
Action Date. Where did you get the icon?

Thanks!

Steve
(e-mail address removed)
 
A

Albert D. Kallal

Also in the picture above that you have a button with a calendar icon for
Action Date. Where did you get the icon?

If you mean the full screen calendar here: that is simply a bunch of
sub-forms
http://www.kallal.ca/ridestutorialp/setdriver.htm

If you mean just the icon picture on the buttion that launches the above?
That picture is one of the
standard icons I simply selected from the "list" of icons when you hit the
[...] button for the picture on a button. The name of the icon is called
calendar...it is one of the built in icons that access has had for 10+
years...going back to access 95 I think..
Could I get a copy of your Print Labels form in
http://www.kallal.ca/ridestutorial/quick/quick.htm. I really like how you
select the start position to print labels. Are those really optiom
buttons?

It is actually a option group I created with the wizard. Each button was
given a value from 1 to 30.

I don't have a download for that form as of yet. (I would have to pull it
out of an application, and document the code + use). However, the code used
to start at a partilcar label is:

Dim bolSkipOn As Boolean
Dim intStartLabel As Integer

Dim bolFirstSkip As Boolean

Private Sub Report_NoData(Cancel As Integer)

Beep
MsgBox "No names found based on your selection", vbExclamation
Cancel = True

End Sub


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)


If bolSkipOn = True Then

If (PrintCount <= intStartLabel) And (bolFirstSkip = True) Then
bolFirstSkip = True
Me.NextRecord = False ' Skip missing labels on sheet
Me.PrintSection = False
Else
bolFirstSkip = False ' lets turn the skip system off...
Me.PrintSection = True ' Print labels
Me.NextRecord = True
End If

End If
End Sub

Private Sub Report_Open(Cancel As Integer)

bolSkipOn = True
intStartLabel = Forms!GuiLabels.StartWhatLabel - 1

DoCmd.Maximize

End Sub

Private Sub ReportHeader_Print(Cancel As Integer, PrintCount As Integer)

bolFirstSkip = True

End Sub

Perhaps when I have some extra time, I will post that example of the label
printing form. The above code is the "meat" of the solution, and using
the wizard to create the option buttons...you can build this in little
time...
 
S

Steve

Thanks, Albert! I can take it from there.


Albert D. Kallal said:
Also in the picture above that you have a button with a calendar icon for
Action Date. Where did you get the icon?

If you mean the full screen calendar here: that is simply a bunch of
sub-forms
http://www.kallal.ca/ridestutorialp/setdriver.htm

If you mean just the icon picture on the buttion that launches the above?
That picture is one of the
standard icons I simply selected from the "list" of icons when you hit the
[...] button for the picture on a button. The name of the icon is called
calendar...it is one of the built in icons that access has had for 10+
years...going back to access 95 I think..
Could I get a copy of your Print Labels form in
http://www.kallal.ca/ridestutorial/quick/quick.htm. I really like how you
select the start position to print labels. Are those really optiom
buttons?

It is actually a option group I created with the wizard. Each button was
given a value from 1 to 30.

I don't have a download for that form as of yet. (I would have to pull it
out of an application, and document the code + use). However, the code
used
to start at a partilcar label is:

Dim bolSkipOn As Boolean
Dim intStartLabel As Integer

Dim bolFirstSkip As Boolean

Private Sub Report_NoData(Cancel As Integer)

Beep
MsgBox "No names found based on your selection", vbExclamation
Cancel = True

End Sub


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)


If bolSkipOn = True Then

If (PrintCount <= intStartLabel) And (bolFirstSkip = True) Then
bolFirstSkip = True
Me.NextRecord = False ' Skip missing labels on sheet
Me.PrintSection = False
Else
bolFirstSkip = False ' lets turn the skip system
off...
Me.PrintSection = True ' Print labels
Me.NextRecord = True
End If

End If
End Sub

Private Sub Report_Open(Cancel As Integer)

bolSkipOn = True
intStartLabel = Forms!GuiLabels.StartWhatLabel - 1

DoCmd.Maximize

End Sub

Private Sub ReportHeader_Print(Cancel As Integer, PrintCount As Integer)

bolFirstSkip = True

End Sub

Perhaps when I have some extra time, I will post that example of the label
printing form. The above code is the "meat" of the solution, and using
the wizard to create the option buttons...you can build this in little
time...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top