database - Selecting a value of a combo box if the user selects a value in another combo box -


i have ms access 2010 form has combo box called cbxclass , combo box called cbxcourse + 1 called cbxinstitute. right form works selecting institute , values in cbxcourse change according institute. cbxclass values inside combo box change according institute. cbxclass values change according class belong institute, problem that, want user able select class cbxclass , once event happens , selected value of cbxcourse change according course class enrolled in.... class can enrolled 1 course, there 1 choice, automatically select once user choose class drop down menu.

i'm quite new ms access, work on else , don't have experience when configuring macros.

create onlostfocus event combo box cbxclass , add
cbxcourse.value = findcourse(cbxclass.value).

findcourse function returns corresponding course given class, know course belongs given class. , called everytime you'll leave cbxclass combo box. use onchange event well, executed everytime you'll change in cbxclass combo box.

if click on cbxclass control , open control properties, there should tab called "events" or this, have in german. , in tab there should events onlostfocus, onchange, onafterupdate, etc. double click on 1 want use , should see this:

option compare database option explicit  private sub cbxclass_afterupdate()  end sub 

then add statement above , add findcourse function outside of afterupdate event this:

option compare database option explicit  private function findcourse(selectedclass string) string     '// stuff here     '// , return course using following:     findcourse = "thefoundcourse" end function  private sub cbxclass_afterupdate()     cbxcourse.value = findcourse(cbxclass.value) end sub 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -