473,503 Members | 2,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing codes in Microsoft Access

2 New Member
Good day MMcCarthy
Please I'm a beginner in Access programming.
I'm developing a small application for my office use.
On the Form, I would like to have some fields diabled based on selection from a combo.
For instance, immediately after selecting Cars in a combo, the fields Tonnage and AuxTank should be disabled; preventing user from entering values in those two fields.
Thank you for your support.
Fred A.
Aug 25 '20 #1
3 4297
isladogs
457 Recognized Expert Moderator Contributor
Add code to the after update event of the combo. Something like this

Expand|Select|Wrap|Line Numbers
  1. Private Sub Me.comboname_AfterUpdate()
  2.  
  3. Select Case Me.comboname
  4.  
  5. Case "Cars"
  6. Me.Tonnage.Enabled=False
  7. Me.AuxTank.Enabled=False
  8.  
  9. Case "Lorries"
  10. Me.Tonnage.Enabled=True
  11.  
  12. ...
  13.  
  14. Case Else
  15. 'anything not covered in the above goes here
  16.  
  17. End Select
  18.  
  19. End Sub
  20.  
  21.  

If you have a lot of possible variations, a better way of doing this is by using the Tag property.
Give all the controls that you want to disable the same tag value e.g. A

Then in the after update event, loop through the controls and set Enabled=False for all the fields where tag.value=A
Aug 25 '20 #2
Freddie1001
2 New Member
Thank you Isladogs. It worked for me. I appreciate your help.
Sep 30 '20 #3
isladogs
457 Recognized Expert Moderator Contributor
Hi - I'd forgotten about this thread...!
Anyway, you're welcome
Sep 30 '20 #4

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

Similar topics

7
8829
by: tpers | last post by:
How can I convert a datetime value (i.e. now()) to Greenwich Mean Time(GMT) in Microsoft Access 2003? I have an Access database that is shared by a few people across different time zones. The...
0
12002
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
0
934
by: Mythran | last post by:
I can get the column names and OleDbType enumeration value for any given table using VB.Net and the OleDb namespace classes. Is there a way for me to get the Access alias/name of the data type? I...
4
5614
by: Goofy | last post by:
The add database ( MDF ) in Visual Studio 2005 seems to be in SQL Server 2005 format as far as I can tell. Does anyone know how I can import tables ( without having to start writing queries ) from...
3
2013
by: Goofy | last post by:
The add database ( MDF ) in Visual Studio 2005 seems to be in SQL Server 2005 format as far as I can tell. Does anyone know how I can import tables ( without having to start writing queries ) from...
0
1199
by: tigger | last post by:
I managed to connect the Database (Done using Microsoft Access 2003) to our VB program using these codes: We are required to link the names in the database to the names in the...
3
6371
by: Bobby | last post by:
Hi I'm using Access 2003 with SQL server 2000, linked via ODBC. Can anybody tell me how to capture SQL error codes in Access? If this is not possible, is there any way I can simply turn off SQL...
1
1186
by: qwer | last post by:
Hi, I'm desperately trying to import and store data from Visual Basic.Net to Microsoft Access. Does anyone have any idea what codes I have to add in apart from adding the .Jet method as shown below?...
2
1851
by: gnanambigai | last post by:
I am working on a project in wireless sensor networks. I would like to know whether c programming language will be suitable for writing codes. If not which will be more suitable?
1
1806
by: khaledjawaher | last post by:
I am writing an application on my PC to insert record on a Microsoft Access database on another pc that has static ip address remotely. I can ping the remote address of the PC that I want to access...
0
7207
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
7468
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
5598
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,...
1
5023
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...
0
4690
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...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
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...

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.