473,988 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Enabling and Disabling Fields in Access

2 New Member
Hi

I'm a bit of a newbie on Access. I'm using Access 2000 and am trying to disable some fields on a form based on the values selected in other fields on the same form.

I'm using the AfterUpdate function on the fields to enable / disable the fields:

-------------------
Expand|Select|Wrap|Line Numbers
  1. Private Sub field1_AfterUpdate()
  2. If field1.Value = "Partial" Then
  3.     txtdoc.Enabled = False
  4. ElseIf field1.Value = "Full" Then
  5.     txtdoc.Enabled = True
  6. Else
  7.     txtdoc.Enabled = False
  8. End If
  9. End Sub
  10.  
----------------

This works while I am in the record being updated however when I move to the previous / next record the enabled / disabled fields remain acording to the last updated one. Is there a function that I can use to check the data in the previous / next record and enable / disable fields accordingly?

Any help would be much appreciated!
Jul 4 '07 #1
3 7161
Rabbit
12,516 Recognized Expert Moderator MVP
Hi

I'm a bit of a newbie on Access. I'm using Access 2000 and am trying to disable some fields on a form based on the values selected in other fields on the same form.

I'm using the AfterUpdate function on the fields to enable / disable the fields:

-------------------
Expand|Select|Wrap|Line Numbers
  1. Private Sub field1_AfterUpdate()
  2. If field1.Value = "Partial" Then
  3.     txtdoc.Enabled = False
  4. ElseIf field1.Value = "Full" Then
  5.     txtdoc.Enabled = True
  6. Else
  7.     txtdoc.Enabled = False
  8. End If
  9. End Sub
  10.  
----------------

This works while I am in the record being updated however when I move to the previous / next record the enabled / disabled fields remain acording to the last updated one. Is there a function that I can use to check the data in the previous / next record and enable / disable fields accordingly?

Any help would be much appreciated!
Please use the Code Tags.

You have to put a copy of this code in the On Current event of the form.

Also, it would be simpler for you to just do:
Expand|Select|Wrap|Line Numbers
  1. If field1.Value = "Full" Then
  2.     txtdoc.Enabled = True
  3. Else
  4.     txtdoc.Enabled = False
  5. End If
  6.  
Jul 4 '07 #2
Timas
2 New Member
Please use the Code Tags.

You have to put a copy of this code in the On Current event of the form.

Also, it would be simpler for you to just do:
Expand|Select|Wrap|Line Numbers
  1. If field1.Value = "Full" Then
  2.     txtdoc.Enabled = True
  3. Else
  4.     txtdoc.Enabled = False
  5. End If
  6.  
That's done the trick! Thanks for this Rabbit!
Jul 5 '07 #3
Rabbit
12,516 Recognized Expert Moderator MVP
That's done the trick! Thanks for this Rabbit!
Not a problem, good luck.
Jul 5 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2849
by: HumptyDumpty | last post by:
Does anyone know if there is a problem with re-enabling the Screen Saver after it has been disabled programmatically. I am using the SystemParametersInfo function within User32.dll, and have been successful in disabling the Screen Saver, but it does not work for re-enabling. The only way I can re-activate it is to re-apply the settings through the Display properties in the Control Panel. Sample lines of code, in simplest form:
2
1399
by: adeelanjum2001 | last post by:
i am using radiolist box control in my page. when i disable radiolist box when page is displayed first time, that is not ispostback, and when i try to enable it with my javascript code afterwards, it is never enabled. i have searched dozens of site looking for this problem. is there any way around of this problem. thanks in advanced
7
2246
by: John Meyer | last post by:
I have a program where I have to enable or disable a list box based upon a radio button. Is there an "enabled" property on select boxes?
4
2463
by: Raj | last post by:
Hi, I have set of exposed web method (C#, framework). Now set of retailer uses these methods and they are identified by their retailer ids. Question is, Is there any way to disable a few methods based on retailer id? This is required because few methods are not relevant for some retailer but useful for others. Help will be highly appreciated.
5
1441
by: Chris Saunders | last post by:
I'm hoping that this question is not off topic on this newsgroup. If it is please redirect me if you know an appropriate group. I'm actually writing a program in another language (Eiffel) but if I can learn how to accomplish this in C I can convert the solution. What I wish to do is use PostThreadMessage() to send a message to a control so that it will become enabled/disabled. Reading the documentation on WM_ENABLE leads me to believe...
1
1589
anukagni
by: anukagni | last post by:
HI friends, In my access database i want to get in an operation which should reflect in the report as what i said... Concept -- this is an billing database. In the bill entry form i want to add an option button which should control an combo box which reflects in the bill report .. Now details about the field that field is for Tax filling which is an depending field from another table .
2
1946
by: enambo | last post by:
In MS Access, i would to give the locking system to certain user, by which they can enable or disable to work on certain data entry or reports. How can i work on that? Kartik
1
2571
by: allamaria | last post by:
I am creating a form in Access, in the form there is a checkbox and some fields. I want to set the checkbox so, that if the user clicks on it, the fields should be enabled, if the checkbox has not been clicked, thann the fields remain disabled. Could you please help me to write the VBA-code for this procedure? Thank you!! Alla
0
11912
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11488
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11704
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7691
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6657
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5241
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3824
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.