A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Locking Check Boxes



 
 
Thread Tools Display Modes
  #1  
Old April 27th, 2010, 12:19 PM posted to microsoft.public.access.forms
MEL
external usenet poster
 
Posts: 249
Default 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  
Old April 27th, 2010, 12:48 PM posted to microsoft.public.access.forms
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default 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  
Old April 27th, 2010, 12:48 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.