If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Locking Check Boxes
I have a form where i want to select one option or the other, so a user will
have a laptop OR a desktop. i want to be able to only select one of the check boxes and also lock the check box after the new record has been updated. any help on this would be great... |
#2
|
|||
|
|||
Locking Check Boxes
hi Mel,
On 27.04.2010 13:19, Mel wrote: I have a form where i want to select one option or the other, so a user will have a laptop OR a desktop. i want to be able to only select one of the check boxes and also lock the check box after the new record has been updated. Use an Option Group and add two new Check Boxes into it. But the question here is: How do you store this information? There are basically three possibilities: 1) Using a Yes/No field, e.g. IsLaptop, then you need only one Check Box 2) Using a Number (Long) field, to store a value mapped to an Option Group with Option Buttons. 3) Using a lookup table with a Combo Box. Problems: Case 1) Your criteria should be IsMobile, then one Check Box makes sense. Case 2) You need to "hard code" the values in the form design (with your Option Group), you can't derive any meaning in the database from the value. Using the terms 'laptop' and 'desktop' indicates that you distinguish between types of real objects, which makes it an entity in terms of database design: http://en.wikipedia.org/wiki/Entity So you should use the 3th method. Which also provides an easy method to extend this select, e.g. if in future has an iPad or a Slate, then you can simply add 'Tablet' as third entry in the lookup table. The locking is normally done in the form's On Current event: Private Sub Form_Current() yourControlName.Locked = True End Sub I would place the unlocking into the On Dirty event: Private Sub Form_Dirty(Cancel As Integer) yourControlName.Locked = Not Me.NewRecord End Sub mfG -- stefan -- |
#3
|
|||
|
|||
Locking Check Boxes
You would do better to use an option group if the selections are mutually
exclusive. You can use check boxes within an option group, if you prefer them to radio buttons. In any case, if you want to allow data entry only for a new record you could set the Data Entry property of the form to Yes, or you could have something like this in the form's Current event: Me.SomeControl.Locked = Not Me.NewRecord You may want to allow a way to unlock, though, so that any errors can be corrected. Mel wrote: I have a form where i want to select one option or the other, so a user will have a laptop OR a desktop. i want to be able to only select one of the check boxes and also lock the check box after the new record has been updated. any help on this would be great... -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201004/1 |
Thread Tools | |
Display Modes | |
|
|