Solved

MS Access Combobox link

Posted on 2011-03-24
4
245 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now