Combo Box on Continuous Form - problem with filtering

  • Thread starter Thread starter tizmagik
  • Start date Start date
T

tizmagik

I have a combo box (say: cboApps) on a continuous form (say: [subForm]
of parent [mainForm]) that is currently bound to a table. Lets say,
Table is named [Apps]; Apps has an AppName, AppID and a DepartmentID.
Now there are only 4 or so Departments and since [mainForm] has the
desired Department already filled out OnLoad, I need to be able to
filter subForm.cboApps based on the DepartmentID that is in mainForm.

Okay, now that wouldn't be a problem if generating a simple SQL Select
statement and setting subForm.cboApps.RecordSet = SQLSelectStatement or
something like that would work, but it doesn't work as I need it to.
What happens is that the cboApps is, in fact, filtered correctly and
only displays the appropriate Apps, but unfortunately, upon specifying
the new RecordSet, cboApps loses the information that may have been
there before.

Is there any way around this?
 
I think I figured it out. If in the Design's form you use the Combo box
wizard that prompts, just have it lookup the data from a query (or you
can specify it in VBA code, like I did) and have the Combo box save
it's value in ANOTHER field (text-field is what I used). Seems to fix
the resetting of the value bug. :)
 
Back
Top