473,386 Members | 1,830 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,386 software developers and data experts.

Enable/disable controls on a Tabulated Form

15
Hi all,

This is my first post, so please excuse if i am posting a silly question.

I have an MS Access database and have created a tabulated form (where there are multiple lines, one for each record - similar to a table, hence the name). There are about 10 fields or so, and i have used textboxes, combo-boxes and checkboxes to represent the fields.

What I am trying to do is to enable or disable textbox_2, depending on the value of textbox_1 for the *same* record. I have tried using VBA code in the AFTER_Update event but the problem is that when i update textbox_1, it disables or enables textbox_2 for *all* records.

Is there a way I can tell Access to only disable/enable textbox_2 for the *same* record?

Your help is much appreciated.
Oct 23 '06 #1
4 3507
MMcCarthy
14,534 Expert Mod 8TB
The short answer is no.

However, although the textbox will be disabled for all records you can reset it to enabled in the OnCurrent or OnActivate event in the form so that when you move to the next record the textbox will be enabled again.
Oct 23 '06 #2
chengsi
15
Hi mmcarthy,

I've tried to do as suggested but could not get it to work. Could you go into that solution with a bit more detail, that is what i should be telling each control/form event to be doing?

Much appreciated.
Oct 26 '06 #3
NeoPa
32,556 Expert Mod 16PB
You could try putting in some code in the 'OnCurrent' event.
It wouldn't set it all up as the records display, but it would ensure the operator could only ever enter fields that were ok by your code.
Oct 26 '06 #4
MMcCarthy
14,534 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form_OnCurrent()
  3.  
  4.     If Me.textbox_1 = "some string" Then
  5.         Me.textbox_2.Enabled = True
  6.     Else
  7.         Me.textbox_2.Enabled = False
  8.     End If
  9.  
  10. End Sub
  11.  
  12.  
By putting this value in the forms on current event it will run each time the form record changes.

If you are using tabbed pages you should be able to run this instead in the on change event of the tab control.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub TabCtlName_Change()
  3.  
  4.     If Me.textbox_1 = "some string" Then
  5.         Me.textbox_2.Enabled = True
  6.     Else
  7.         Me.textbox_2.Enabled = False
  8.     End If
  9.  
  10. End Sub
  11.  
  12.  
Oct 26 '06 #5

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

Similar topics

1
by: Manatee | last post by:
Hi group. I have exactly one external, alternate stylesheet that I want to enable or disable by form controls, on one page only (not saved across pages). I used: <link rel="alternate...
3
by: DBQueen | last post by:
I have a form with lines of controls. On some of the lines there are 3 controls (call them A,B,C); other lines have only control A. The controls have been numbered sequentially (Q20, Q21....Q76)...
1
by: Tim Bücker | last post by:
Hello. I have a form with some controls on it. One of these controls is a button that disables/ enables all the other controls. The form itself should also be "disabled/enabled", so I set...
6
by: Stu Carter | last post by:
Hi, I have an aspx page where some controls are initially disabled by the code-behind 'Page_Load' event. I want these controls to be dynamically enabled when the user checks a checkbox. ...
2
by: buran | last post by:
Dear ASP.NET Programmers, I have a web user control (a search menu) which has 2 validation controls (one for input and another for the search criterion). I am including this search user control...
7
by: Phil | last post by:
on my form I have a checkbox and a tab control when the checkbox is true I wish to enable the controls on a single page of the tab control, is this possible or do I need to enable each control on...
3
AccessIdiot
by: AccessIdiot | last post by:
I was successful with help from another thread (this one ) in enabling and disabling a form/subform with a button. Essentially you press a button on the form and the form controls are disabled but...
2
by: Naushad | last post by:
Hi all, I am using the countinous form. I want to Enable/Disable the some fields for perticular records as per the following condition when open the form. I have written this code in "On Current...
5
by: Dan Tallent | last post by:
I have a scenerio when my forms are first opened that the user cannot modify the data. The fields are disabled to prevent them from modifying any of the data. If a user wishes to modify the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.