Link to home
Start Free TrialLog in
Avatar of madeatmidnite
madeatmidnite

asked on

How to make checkbox not enabled after it is checked in continuous form

I have a contiunuous for with a checkbox (SaveCheck).  I use the following code (placed on the On Current and After update) to lock the record with the checkbox on it:
Me![Med].Locked = Me![SaveCheck]
Me![Sig].Locked = Me![SaveCheck]

Works great, but now I would like to have the checkbox not be enabled after the changes.   This way they will not be able to change the record again, but making the checkbox false.  Anything I try will either disable the checkbox for the whole form (not just the current record) or doesn't seem to work at all.

Any help greatly appreciated.

Carrie
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

AFAIK you can't edit properties like .Enabled in a continuous form for only one record.

What you can do is to write code in the checkbox's .AfterUpdate event that checks certain criteria, and if it's met, do nothing.

Hope this helps.
-Jim
Which version of access are using? If you are using Access 2000 or above, you can use Conditional formating to achive this. Its under FORMAT menu -> CONDITIONAL FORMATTING. Set the condtion you want to meet, and select the enable button.


You would choose, Condtion , 'Field Value Is', then select 'Equal', put TRUE and click enable button.
Avatar of madeatmidnite
madeatmidnite

ASKER

Thanks, it is Access 2002.   I'm going to give it a try -- be right back :)
carrie
It won't let me get to the conditional formatting with the checkbox.  It will let me if I try to go to one of the other text boxes, but it doesn't seem to like the checkbox being selected.  Any idea on what I am doing wrong ?

thanks
Carrie
ASKER CERTIFIED SOLUTION
Avatar of arcross
arcross
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I just didn't want to let them be able to check the box again and then be able to change the record (with the checkbox checked, it does a nice job of locking the current record).  Would your way do that?  

thanks for looking that up :)
carrie
Guess What ?

I added

Me![SaveCheck].Locked = Me![SaveCheck]

to my above code and it worked :)
I thought I had tried it once before and it didn't work well -- but now it seems to work fine !

Thanks for all your help.
Glad it worked Carrie!
Sorry to bother, but it works great when it is in the form itself, but it doesn't like it when it becomes a subform.  Any suggestions?
thanks
carrie
What happens??
Got it to work ok, except it doesn't like me to open a new record unless I am going in order.  If I go up a record or two to edit it and then try to enter a new record, it won't let me.  If I exit the program and then restart, it will work until I go out of order again :)  Have tried doing requery, but it looks like it is requerying the whole table that it is based on and I think that will start taking too much time as the database grows.  ALso tried Refresh, but didn't seem to get that to work either.  If you have any suggestion, that would be great.
thanks,
carrie
Actually, just played with it somemore, what it doesn't like is if the last SaveCheck is checked.  IF that is the case then, it won't let me open the new record.  Could it be because both the field and the checkmark are null and so with
Me![Med].Locked = Me![SaveCheck]  
they both are null so they are locked?  That's the only think I can think of.

Thanks,
carrie
Hi madeatmidnite

Since you've already accepted this question, you would get more expert responses if you create a new question, instead of posting follow-ups to this one.

Just my .02.
-Jim
TY
-Jim