Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COMBO BOX REFRESH ? NEED ASSISTANCE ON HOW TO DO 1

Status
Not open for further replies.

Paul7905

MIS
Jun 29, 2000
205
US
Question :<br>I have Three combo boxes on a form which allows the client to add new inventory records to a table.&nbsp;&nbsp;Each Combo box has a record source query based on information contained in the other combo boxes (the user can select from a list when they click on the combo box). <br><br>The underlying data structures consist of &quot;Department&quot;, &quot;Class&quot; and &quot;SubClass&quot;, i.e. if the client selects &quot;Hardgoods&quot; from the Department combo box, when they click on the &quot;Class&quot; combo box, only the &quot;class&quot; descriptions for the &quot;Hardgood&quot; department should display.<br>This is the same for &quot;SubClass&quot;, i.e. only subclass descriptions for the &quot;Class&quot; chosen by the user will display.<br><br>I can get this to work (sort of) by putting a Forms!Refresh in the update event of the box. This causes other problems however as since the record fields are &quot;required&quot; the refresh tries to &quot;write&quot; the new record to the table ~(before the other combo selections are made) etc. etc.<br><br><br>What i want to do is to get the &quot;record source query&quot; fior the combo box to run (or refresh) when the user clicks on the combo box (or the box gets focus)..........&nbsp;&nbsp;but i cannot see how to do this (without &quot;refreshing&quot; the entire form.<br><br>In a nutshell: <br>Is there a way to refresh a combo box when the user clicks on it (WITHOUT refreshing the entire form?)<br><br>The data displayed is dependant on what the user selected in another combo box on the same form)
 
Let me try to give a solution to it :-<br><br>Suppose the three combo boxes are CboDept, CboClass, CboSubClass<br><br>The Row Source property of CboDept will be the table which has the list of all the Departments<br><br>The Row Source property of CboClass will be the table which has the list of all the Class with a where clause (where department = forms![&quot;form name&quot;]!CboDept<br><br>The Row Source property of CboSubClass will be the table which has the list of all the Class with a where clause (where department = forms![&quot;form name&quot;]!CboClass<br><br>This way you will always have only related options in the combo drop down <br><br>Try this ... it will work...<br><br>Vandys<br>
 
Ok from what you describe you need to requery the sucsesive combo boxes to reflect the range of items in the next combo box.<br><br>as the data source is a query it will pick up the &quot;department&quot; choice that the user selects, so after the &quot;department&quot; update event add some vba like<br><br>me.class.requery<br>me.subclass.requery<br><br>you may need to requery the third combobox control at this point so it atleast reflects the correct range of data if the user accepts the first &quot;class&quot; option presented after the control requery<br><br>and of course <br><br>in the class_afterupdate<br><br>me.subclass.requery<br><br>(how come this doesn't auto correct :) )<br><br>this method will make sure that the data range in the second and third comboxes is relevent to the firs combox selection.<br><br>hope this helps,<br><br>Robert<br><br>
 
THIS IS WONDERFUL !&nbsp;&nbsp;WORKED BEAUTIFULLY. THANKYOU SO MUCH (BEING NEW TO ACCESS I AM LEARNING AS I GO AND WITHOUT THE HELP OF FOLKS LIKE YOU IT WOULD BE A REAL STRUGGLE, AGAIN, THANKS SO MUCH)<br>PAUL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top