Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disabling check boxes on ONE record at a time. 1

Status
Not open for further replies.

accessguy52

Programmer
Sep 18, 2002
73
0
0
US
Does anyone know how I can disable the checkboxes on a continous formsheet for one record? I have a "questionnaire" type of form where I have a N/A checkbox which should, when checked, disable ONLY the other checkboxes on that particular record. Instead, it naturally disables the checkboxes on ALL the records. Has anyone found a workaround for this? I've thought about using DoCmd.GoToControl, and GoToRecord but would that work? Thanks for any input.

accessguy52
 
Try through recordsets...

e.g.

Dim rs as dao.recordset ' requires DAO 3.6 reference
set rs = currentdb.openrecordset("yourtable", dbopendynaset)

rs.findfirst(your criteria)
rs!checkboxtoupdate = 0

rs.close

Untested code here, so you might need to play.. let me know if you need a hand.

------------------------
Hit any User to continue
 
Hmmm...a workaround, but not with Enabled, but with Locked:

The checkbox must be bound to a field in the recordset.
Use the Current event to lock/unlock all controls except the checkbox. Same code should run in the AfterUpdate event of the checkbox:

Private Sub LockUnlock()
Dim ctr As Control
On Error Resume Next
For Each ctr in Me.Section(0).Controls
If ctr.Name <> "CheckBoxName" Then ctr.Locked = Me("CheckboxName")
Next
End Sub

Private Sub Form_Current()
LockUnlock
End Sub

Private Sub CheckBoxName_AfterUpdate()
LockUnlock
End Sub


The truth is that the controls in all records will be locked/unlocked, but since you can only have ONE active record, the goal is achieved...

Place a small textbox in the detail section:
=[CheckBoxName]
Make sure the font color is the same with the back color.

For this textbox, use Conditional formatting to set the back color AND fore color to red if the checkbox is true.

This will be an indication of the records that are locked or unlocked.

Conditional formatting is not available in Access 97 or earlier.

HTH



[pipe]
Daniel Vlas
Systems Consultant

 
Daniel - cool! that worked beautifully! I'll have to save that one for future use. Now I have ANOTHER question: I've changed the check boxes to radio buttons, per my clients. These buttons still bound to their respective record flds, but, how can I keep them exclusive? That is, as unbound radios/option group, I can choose ONLY one button, but as bound flds I can choose many/all of them. How can I get only one, exclusively? I can't make them part of an option group. Anyone? Thanks!

accessguy52
 
Hi,
I have a problem using checkboxes.There are many checkboxes on my form and any numner of them can be checked at a time.The problem is, once i check few checkboxes, they remain checked for all the following records.I want it in such a way that, once i'm done with entering all the field and selecting the checkboxes for one record and when i press next for the next record, everything is clear except the checkboxes, which remain chescked.So how do i tackle with this?
Nisha
 
Either bind the checkboxes to fields or use the Current event of the form to clear them.
If you have a naming rule (chkBox1, chkBox2 and so on) you can use a simple loop to uncheck them:

For Each ctr In Me.Controls
If Left(ctr.Name, 3) = "chk" Then
ctr = False
End If
Next

HTH



[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top