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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enable Checkbox on Load

Status
Not open for further replies.

kcmark

Technical User
Nov 2, 2002
63
US
I have a form that displays a variety of fields. If one of the fields meets a certain criteria then I want a checkbox to become enabled - otherwise the checkbox stays disabled. I am having problems getting the form to do this when the form opens (ie: there is not event - other than just opening the form). Any ideas?
 
Try using an OnCurrent Event. This will trigger the code every time the form goes to a different record, including the record displayed on open.

ChaZ

Ascii dumb question, get a dumb Ansi
 
Thanks - but it did not work - I am using a continuous form if that makes any difference.
 
The OnLoad event works, but the criteria will be assesed, based on the first record only. This might be fine for your needs. If the 1st record enables your checkbox, then all subsequent records will have it enabled also, regardless if whether or not, they meet the same criteria.
The OnCurrent event will scrutinize the criteria, as you go, from record to record, enabling & disabling the checkbox accordingly.
Hope this helps, good luck!
 
My post go to you late, already answered.
Yes it can make a difference, changing forecolor sometimes works (a little unstable), not sure if conditional formatting can enable or disable?
 
You say the on current event for the form does not work? Can you describe the error?

Alternatively, an on got focus event for the check box would also work.

ChaZ

Ascii dumb question, get a dumb Ansi
 
I have the OnCurrent Event set up, but I am still having a problem. The code I wrote makes all line items the same (either all enabled or all disabled). If I click on a box that should be disabled then all lines become disabled - Likewise if I click on a box that should be enabled then all lines become enabled. Is there any way to have it look at each line item and enable/disable independently?

If Me!C1 = -1 Then
Me!PR.Enabled = True
Else
Me!PR.Enabled = False
End If
 
In the detail section of a continuous form, an unbounded control stands for ALL records.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
My checkbox and all the criteria are bound. Essentially I am trying to build in a control that will not allow a clerk to approve a payment if certain criteria are not met (ie: the approval check box will not even be enabled if the pmt criteria are not met)
 
Change the on current event to on got focus for the check box.

Have that event check the criteria against the form, and set set the box accordingly.

I just tested it with a temp db using a bound check box, and it worked.

ChaZ

Ascii dumb question, get a dumb Ansi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top