Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MS Access Combobox link

Posted on 2011-03-24
4
Medium Priority
?
251 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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

688 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