3 cascading combo boxes with a subform

Jaymin

Registered User.
Local time
Tomorrow, 02:28
Joined
Oct 24, 2011
Messages
70
Hope some can help me, i have read many cascading threads and tutorials and videos on the subject and still it does not work,
My scenario is that I have a form named “frmMain” on it has three cascading combo boxes, the first named “cboStation”, the second “cboStaff” and the third is “cboPPE” and a sub form called subfrmMaint to enter the required data
tblStation
pk IDStation
stationName

tblStaff
pk IDStaff
firstName
surname
Fk IDStation

tblPPE
Pk IDPPE
chipNumber
fk IDStaff
fk IDMaint

tblMaintenance
pk IDMaint
Date
afterUse
repairs
fk IDPPE

first I use the cboStation to filter the names for the cboStaff then that is used to filter the chip number for the cboPPE, which is then used to filter a subform so I can enter details into the it, called subfrmMaint.
When ever I open the cboStaff I keep getting a form appearing with “Forms!frmMain!cboStation” requesting me to enter something so it can filter combo box but ends up blank.
In the row source field for cboStaff :-
SELECT tblStaff.IDStaff, tblStaff.FirstName FROM tblStaff WHERE (((tblStaff.IDStation)=forms!frmMain!cboStation)) GROUP BY tblStaff.IDStaff, tblStaff.FirstName;
This has confused me, I have spent many hours on this to no avail, hope some can help please.
does the form have to have a record source?:cool:
Peter
 
Pbaldy,
Thanks for you reply, I have found what is going on but donot why or how to fix it hope you can help.
I created two cascading combo boxes, one for “StationName”, “cboStation”the other for “Staff”, “cboStaff” and with txt boxes bounded to them, when I entereddata into “cboStation” the first txt box gets data in it, when I open the “cboStaff”it is filtered by the “cboStation” and the second txt has data in it, all seemsok except

the second combo box is not been requeried yet.

When I add the requery function in to the “after update”event

Option Compare Database
Private Sub cboStation_AfterUpdate()
Me.cboStaff.Requery
End Sub

It causes the form not to work, looks like this, and the txtboxes loose their focus, although the “control source” is =[cboStation] isstill the same, and the “cboStaff” when selected causes the form “EnterParameter Value” to open.

I
can delete the combo, txt boxes and the VBA code “requery”and start again on the same form but it still will not work, the problem staysthe same, but if I create a new form I can get to work up to the “requery”, wherethe problem starts over again.

Peter
 

Users who are viewing this thread

Back
Top Bottom