Checkbox problems

G

Guest

Hello,

Problem concerning the following:

I need to solve a problem with checkboxes.

In a form a checkbox is placed, next to it are two
textboxes. The textboxes are for the startdate and enddate.
The checkbox has to be checked to "activate" the entered
dates in both textfields. When the checkbox is checked a
command button has to be pressed to give a command to
printpreview the report.

Layout:

table: tblSource fields: date
sta
form: frmDate
report:rptDate

How do I solve this problem?

Thanx,

Martijn
 
M

Marshall Smith

What exactly is your problem? Are you having trouble getting the textboxes
to "activate" and "deactivate?"

If so, this can be handled a couple different ways. The easiest, if you are
using Access 2000 or later, is to use Conditional Formatting (under the
Format menu). Simply set the conditional formatting of the two textboxes
and command button to be enabled when the value of the checkbox is true, and
disabled when it is false. (If you can't find it, the "enabled" setting is
in the lower right corner of the format options on the Conditional
Formatting screen.)

If you can't, or don't care to, use that option, you can put code in the
AfterUpdate event of the checkbox and the Current event of the form to
enable and disable the textboxes and command button. The code should look
something akin to:

If Me.chkActivate = 0 Then
Me.txtStartDate.Enabled = False
Me.txtEndDate.Enabled = False
Me.cmdPreviewReport.Enabled = False
Else
Me.txtStartDate.Enabled = True
Me.txtEndDate.Enabled = True
Me.cmdPreviewReport.Enabled = True
End If

HTH,

Marshall Smith
Project Developers, Inc.
 

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