Combo box in a detail record for input

Z

zombeerose

I have created 2 forms - 1) Master form for selecting a
person and 2) Sub form for entering 1+ time logs for the
selected individual. On the Sub form, the detail section
can display multiple records. Per each detail record, a
job can be assigned as well as a corresponding job step.
Both the job and job step can be selected from drop-down
combo boxes.

I have written code to update the rowsource for my job
step combo box when the job combo is changed. The problem
is that when a user selects a different job from the combo
box, the row source for EVERY job step combo box is
changed rather than the corresponding detail record.

Code for updating rowsource:
"Private Sub JobIDCombo_Change()
On Error GoTo JobIDCombo_Change_Err

Dim JobID As Long
JobID = JobIDCombo.Column(1)

If JobID > 0 Then
JobStepCombo.RowSource = "SELECT Description FROM
[JobStep] WHERE JobID = " & JobID
Else
JobStepCombo.RowSource = ""

End If
JobStepCombo.Requery

Exit Sub

JobIDCombo_Change_Err:
MsgBox Error$
End Sub"

Any help is greatly appreciated.
 
G

Gerald Stanley

If I have understood you correctly, the Job Combo Box is an
unbound control on the sub form and the sub form is itself
a continuous form.

If I am correct, then the only solution is to change the
sub form from continuous to a single form. The reason
being that unbound controls exist as a single instance on
continuous forms and not as a unique instance on each form
occurence.

Hope That Helps
Gerald Stanley MCSD
 
Z

zombeerose

Gerald,
Thank you for your help.
Z
-----Original Message-----
If I have understood you correctly, the Job Combo Box is an
unbound control on the sub form and the sub form is itself
a continuous form.

If I am correct, then the only solution is to change the
sub form from continuous to a single form. The reason
being that unbound controls exist as a single instance on
continuous forms and not as a unique instance on each form
occurence.

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I have created 2 forms - 1) Master form for selecting a
person and 2) Sub form for entering 1+ time logs for the
selected individual. On the Sub form, the detail section
can display multiple records. Per each detail record, a
job can be assigned as well as a corresponding job step.
Both the job and job step can be selected from drop-down
combo boxes.

I have written code to update the rowsource for my job
step combo box when the job combo is changed. The problem
is that when a user selects a different job from the combo
box, the row source for EVERY job step combo box is
changed rather than the corresponding detail record.

Code for updating rowsource:
"Private Sub JobIDCombo_Change()
On Error GoTo JobIDCombo_Change_Err

Dim JobID As Long
JobID = JobIDCombo.Column(1)

If JobID > 0 Then
JobStepCombo.RowSource = "SELECT Description FROM
[JobStep] WHERE JobID = " & JobID
Else
JobStepCombo.RowSource = ""

End If
JobStepCombo.Requery

Exit Sub

JobIDCombo_Change_Err:
MsgBox Error$
End Sub"

Any help is greatly appreciated.
.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top