From: Mel on
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...

From: Stefan Hoffmann on
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 <--
From: BruceM via AccessMonster.com on
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/Forums.aspx/access-forms/201004/1