For KEN SNELL ... filter one combo box to another...

  • Thread starter Thread starter Tina Marie
  • Start date Start date
T

Tina Marie

Hi Ken ... couldn't get back into my original post ... this system is
incredibly slow ... code still not working ... want to send you screen shots
of what I have done ... can't do it in this forum ... can I email you from my
hotmail ... its (e-mail address removed) ... even if you set up a temporary
hotmail account (in case you are not suppose to contact us directly) ...
 
Having reviewed the screen shots that you emailed to me:

The RowSource expression is wrong for the cboSubTheme combo box. Change it
to this:

SELECT tblListOfSubThemes.strSubTheme FROM tblListOfSubThemes WHERE
tblListOfSubThemes.strTheme = [cboTheme];


Your ColumnCount value is 1, so your query should not have more fields in it
than this count value. There's no need to include the strTheme field in the
SELECT clause; you just want it for filtering.

Your reference to Forms!sfrmAllThemes!cboTheme is invalid in your original
RowSource expression because the sfrmAllThemes form is not actually open on
its own merits; it's a subform in your main form. Therefore, your query
cannot "see" the result when you use the form as a subform. All you need is
the reference to the first combo box, without any reference to Forms
collection. By doing this, your query will work whether you use the
sfrmAllThemes form as a subform or as a main form. If you really wanted to
reference the subform when it's a subform, the the reference would be
Forms!PutNameOfMainFormHere!sfrmAllThemes!cboTheme -- but I do not recommend
this!

Your VBA code looks fine to me.

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


Tina Marie said:
Ok ... will do ...
 
Thanks soooooooooooooo much Ken!! It works!! Wanted to say I appreciate
that you never gave up on helping me find the answer and also explained the
'why'!!
--
Thanks!!

T. Marie


Ken Snell MVP said:
Having reviewed the screen shots that you emailed to me:

The RowSource expression is wrong for the cboSubTheme combo box. Change it
to this:

SELECT tblListOfSubThemes.strSubTheme FROM tblListOfSubThemes WHERE
tblListOfSubThemes.strTheme = [cboTheme];


Your ColumnCount value is 1, so your query should not have more fields in it
than this count value. There's no need to include the strTheme field in the
SELECT clause; you just want it for filtering.

Your reference to Forms!sfrmAllThemes!cboTheme is invalid in your original
RowSource expression because the sfrmAllThemes form is not actually open on
its own merits; it's a subform in your main form. Therefore, your query
cannot "see" the result when you use the form as a subform. All you need is
the reference to the first combo box, without any reference to Forms
collection. By doing this, your query will work whether you use the
sfrmAllThemes form as a subform or as a main form. If you really wanted to
reference the subform when it's a subform, the the reference would be
Forms!PutNameOfMainFormHere!sfrmAllThemes!cboTheme -- but I do not recommend
this!

Your VBA code looks fine to me.

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


Tina Marie said:
Ok ... will do ...
 
Back
Top