combo box troubles linking/requery/pain in the butt (1 Viewer)

RpbertS

Registered User.
Local time
Today, 22:55
Joined
Feb 14, 2000
Messages
93
Hi on a continuous subform I have two combo boxes, projectname and subprojectname, these are linked to 2 tables and based on what project is selected I want only the certain subprojects associated with that project to be available in the subprojectname combobox.
this is my code so far
-----------
Private Sub RefreshSubProj()

cboSubprojects.RowSource = "SELECT Subprojects.cbosubprojects " & _
"FROM Subprojects WHERE (((Subprojects.cboProjectName)='" & _
cboProjectName.Value & "'));"
cboSubprojects.Requery
If cboSubprojects.ListCount = 0 Then
cboSubprojects.Value = ""
Else
cboSubprojects.SetFocus
cboSubprojects.Dropdown
End If
End Sub
------------
this is what happens it will work for the first record in the subform and allow you to pick the correct subproject BUT for every other project underneath it the only subprojects that are available are the ones for the first record, and if I try to change the projectname combo box it asks for a parameter for subprojectname.
does anyone have any ideas? or can point me in the right direction?

thanks for the time,
Rpb
 

Carol

Registered User.
Local time
Today, 22:55
Joined
Jan 15, 2000
Messages
280
Make sure that your properties "Cycle" field for your subform is set to All Records instead of Current Record. This could be your problem.
 

RpbertS

Registered User.
Local time
Today, 22:55
Joined
Feb 14, 2000
Messages
93
it's set to all records..shux you had my hopes up to.

any more ideas?
 

Carol

Registered User.
Local time
Today, 22:55
Joined
Jan 15, 2000
Messages
280
Excuse me, I didn't read that it was on a continuous form. For this to work, your SubProjectName should only be on the continuous form. Your main ProjectName field should be on the main form or else an additional subform which references the 2nd subform which is continuous.
 

Users who are viewing this thread

Top Bottom