John Smith wrote:
How can I use a transparent command button to change a checkbox?
I have my records set up in a continuous form and I want theuser to be able
to click on the record and have this toggle the "Print" checkbox. the
command button would be set up as transparent and cover the entire record.
You can use code like this... I'm assuming you have a blnPrint
checkbox on each record (i.e. part of the subform's recordsource).
Note: this is code in the _sub_form.
Private Sub Form_Click()
'---toggles the "Print Me" checkbox. just click on the record
selector.
Me.blnOK = Not Me.blnOK
End Sub
Then you could filter the report you're printing this data in in the
Open event. just pass a filter like "[blnOK]=True" (blnOK is a yes/no
field in my report's recordsource.)
Option Compare Database
'------------------------------------------------------------
' mcrOpenFiltered Report
'
'------------------------------------------------------------
Function mcrOpenFiltered Report()
On Error GoTo mcrOpenFiltered Report_Err
DoCmd.OpenRepor t "rptYourReport" , acViewPreview, "",
"[blnOK]=True", acNormal
mcrOpenFiltered Report_Exit:
Exit Function
mcrOpenFiltered Report_Err:
MsgBox Error$
Resume mcrOpenFiltered Report_Exit
End Function