473,397 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

programmatically lock controls?

Hi,

I'm using Access 2002 and this is my question:

I've got a form in datasheet view containing a checkbox. I want to
lock/unlock this checkbox programmatically dependent on the value of a
another control. I've tried it like this, but the checkbox does not
seem to be set always correctly:

Private Sub Form_Current()
If Me.BATCHVALFROZEN = -1 Or IsNull(Me.EXP_TYPE) Then
Me.BATCHVAL.Locked = True
Else
Me.BATCHVAL.Locked = False
End If
End Sub

Is there a better way to do this?

Thanks,
Stephan

Jul 7 '06 #1
2 2940
That looks correct, but you need to do it in Form_AfterUpdate as well if you
want it locked without having to move to another record and back.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"steph" <st*******@yahoo.dewrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...
>
I'm using Access 2002 and this is my question:

I've got a form in datasheet view containing a checkbox. I want to
lock/unlock this checkbox programmatically dependent on the value of a
another control. I've tried it like this, but the checkbox does not
seem to be set always correctly:

Private Sub Form_Current()
If Me.BATCHVALFROZEN = -1 Or IsNull(Me.EXP_TYPE) Then
Me.BATCHVAL.Locked = True
Else
Me.BATCHVAL.Locked = False
End If
End Sub

Is there a better way to do this?

Thanks,
Stephan

Jul 7 '06 #2
Thanks, it works now!

Allen Browne wrote:
That looks correct, but you need to do it in Form_AfterUpdate as well if you
want it locked without having to move to another record and back.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"steph" <st*******@yahoo.dewrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...

I'm using Access 2002 and this is my question:

I've got a form in datasheet view containing a checkbox. I want to
lock/unlock this checkbox programmatically dependent on the value of a
another control. I've tried it like this, but the checkbox does not
seem to be set always correctly:

Private Sub Form_Current()
If Me.BATCHVALFROZEN = -1 Or IsNull(Me.EXP_TYPE) Then
Me.BATCHVAL.Locked = True
Else
Me.BATCHVAL.Locked = False
End If
End Sub

Is there a better way to do this?

Thanks,
Stephan
Jul 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tom | last post by:
I have the following code as part of a procedure in a standard module: Dim ctrl As Control For Each ctrl In MyForm.Controls If ctrl.ControlType = acTextBox Then MsgBox ctrl.name MsgBox...
8
by: deko | last post by:
I'm trying to find a way to set form/control properties programmatically. In a nut shell: 1. Open a database 2. Open a form in design view 3. Do something like this: For Each prp In...
7
by: Saintor | last post by:
What I do now is I put a value in the tag property, and using the form_current event, I run through all controls properties until the ones with the required tag value are met. Sound OK in theory,...
3
by: Tzvika | last post by:
Hi, Is there a way to programmatically add/remove windows components in c# or in any other language What is the API fro that?
4
by: | last post by:
I have a "form field highlight" javascript that I've added to some of my ASP.NET forms using the following syntax: body.Attributes.Add("onClick", "highlight(event);");...
1
by: charlies224 | last post by:
Hi, I am writting a software that requires me to make sure the Num Lock is always on and Caps Lock is always off. First, I know how to detect if Num Lock or Caps Lock is on or off (if...
32
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's...
3
by: Ken Fine | last post by:
I'm interested in programmatically manipulating groups of ASP.NET controls by type. Can someone suggest code for the following? Loop through, say, all label controls on a page, and assigning a...
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.