Solved

MS Access Combobox link

Posted on 2011-03-24
4
247 Views
Last Modified: 2012-05-11
Can I have code that only allows a combobox to be used if another combobox has a value?
0
Comment
Question by:JSSenior
  • 2
  • 2
4 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
ID: 35208972
Yes.

In the 'another combobox' use the afterupdate event procedure to enable or disable the dependent combo.

If isnull(me.anothercomboboxname) then
me.dependentcombo.enabled = false
else
me.dependentcombo.enabled = true
end if

0
 

Author Comment

by:JSSenior
ID: 35209302
I take it the 2nd combobox will need enabled property set to false?

I currently have code in the form current property which locks the dependant combo if the other is blank but it seems to be locked eitger way.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 35209446
Yes,  the initial setting  in design  view should be false.

If the same form is used to browse records you need exactly the same code in the form_current event procedure.
0
 

Author Comment

by:JSSenior
ID: 35209555
There is sql driving the dropdown values so wondering whether this maybe effecting it. SQl in dependant combo using value in other.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question