combo box dilemma

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a subform in datasheet view. One of the fields pulls from a combo box
based on a table. The list is getting to be beyond 200, which takes forever
to scroll through. Because there are a limited number of what I'll call
"categories", I created a cascading combo box. It was my first try at this,
and I created a separate form as all the tutorials explain. That works,
except I don't know how to open that form from the field in the subform. Is
that even possible to do?

Any responses are appreciated! If I should post more specifics about my
database, please let me know.
 
Hi, Kevin.

I presume you will write the value selected in the 2nd combo box to a field
on your Datasheet form. In the field's On Enter event procedure:

On Error Resume Next

DoCmd.OpenForm _
FormName:="YourSecondComboBoxForm", _
View:=acNormal, _
WindowMode:=acDialog
Me!YourTextbox.SetFocus

should do it. The combo box on the second form should have a RowSource that
filters by the value in the Datasheet. Because it is on a different form,
use the full reference rather than the shortcut Me:

SELECT MyFieldList From MyTable
WHERE MyField = Forms!MyDatasheetForm!MyField
ORDER BY MySortField;

Finally, in the combo box' AfterUpdate event procedure, write the selected
value to your datasheet field, and close the form:

Forms!YourDataSheetForm!YourField = Me!YourComboBox
DoCmd.Close

Hope that helps.
Sprinks
 
Back
Top