Solved

MS Access Combobox link

Posted on 2011-03-24
4
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
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 how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

739 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