Select Multiple Fields from a Combo box

G

Guest

I need 2 fields from a combo box. 1 field, ID is the bound column, and opens 1 subform. I need another field, student, to open a different subform.

How do I link the master and child fields. Master field I tried was cboDcSelect.student Child field is Student. It didn't work.

Any tips would be appreciated.
 
M

Mike Painter

Ripper said:
I need 2 fields from a combo box. 1 field, ID is the bound column, and
opens 1 subform. I need another field, student, to open a different
subform.
How do I link the master and child fields. Master field I tried was
cboDcSelect.student Child field is Student. It didn't work.
Any tips would be appreciated.

The main form should be based on a query containing both fields and then all
you have to do is link the second subform with the Student ID on the form.
You can make the Student ID invisible on the form if you wish.
 
J

John Vinson

I need 2 fields from a combo box. 1 field, ID is the bound column, and opens 1 subform. I need another field, student, to open a different subform.

How do I link the master and child fields. Master field I tried was cboDcSelect.student Child field is Student. It didn't work.

Any tips would be appreciated.

Fields don't "open" subforms! I'm not quite sure what you're trying to
accomplish. What is the rowsource of the combo? What's in the field
[Student], and how is it related to the field [ID]? What are the
recordsources of the two subforms?

I've never tried it but you could try setting the Master Link Field
property of the second subform to

=comboboxname.Column(1)

to use the second field in the combo's rowsource as the master... but
I suspect that there may be other problems with your table or form
design!
 
G

Guest

Thanks for the answers guys. Let me give you more detail as to how this is set up. I was a little tired last night and I didn't make any sense.

I have a combo box, cboDcSelect, it's rowsource is a query, qryDcAll. It has 4 columns, Grade, StudentName, StudentID, and DcViolationID.

The bound column is the 4th, Dress code violation ID, I use this to open 1 subform, subDcSelect. The record source is tblDcViolations. It opens the specific violation entered by the teacher.

I have another subform, subDcPrevious, that is from the Violations, tblDcViolations. This subform is going to show all the violations that each student has. I want to use the student ID in the combo box to open this subform, but have not had any luck.

I tried to make the MasterLink field cboDcSelect.Column(2) and the ChildLink field StudentID, but I keep getting prompted to enter the value for cboDcSelect.Column(2) when the form opens.

I hope this better answers your questions John. I would appreciate any help you guys have.
--
Thanks As Always
Rip


John Vinson said:
I need 2 fields from a combo box. 1 field, ID is the bound column, and opens 1 subform. I need another field, student, to open a different subform.

How do I link the master and child fields. Master field I tried was cboDcSelect.student Child field is Student. It didn't work.

Any tips would be appreciated.

Fields don't "open" subforms! I'm not quite sure what you're trying to
accomplish. What is the rowsource of the combo? What's in the field
[Student], and how is it related to the field [ID]? What are the
recordsources of the two subforms?

I've never tried it but you could try setting the Master Link Field
property of the second subform to

=comboboxname.Column(1)

to use the second field in the combo's rowsource as the master... but
I suspect that there may be other problems with your table or form
design!
 
J

John Vinson

Thanks for the answers guys. Let me give you more detail as to how this is set up. I was a little tired last night and I didn't make any sense.

I have a combo box, cboDcSelect, it's rowsource is a query, qryDcAll. It has 4 columns, Grade, StudentName, StudentID, and DcViolationID.
ok...

The bound column is the 4th, Dress code violation ID, I use this to open 1 subform, subDcSelect. The record source is tblDcViolations. It opens the specific violation entered by the teacher.

Again: a combo box cannot and does not "open" a subform. You don't
need to open a subform; it's opened before the mainform opens, and
just gets populated with data. Are you using cboDCSelect as the Master
Link Field of the subform? or are you actually using code to open a
pop-up form (and calling it a "subform"?

If you just want to *display* the text of the violation, based on the
violation ID, you don't need a subform - instead use a textbox with a
control source like

=DLookUp("[Violation]", "tblDCViolations", "[DCViolationID] = " &
cboDCSelect

or (perhaps better) base the Combo box on a query on tblDCViolations,
selecting the ID but showing the name. The combo you now have will not
let you enter a new violation for a student, which I would guess is
what you want.
I have another subform, subDcPrevious, that is from the Violations, tblDcViolations. This subform is going to show all the violations that each student has. I want to use the student ID in the combo box to open this subform, but have not had any luck.

I tried to make the MasterLink field cboDcSelect.Column(2) and the ChildLink field StudentID, but I keep getting prompted to enter the value for cboDcSelect.Column(2) when the form opens.

In that case put a textbox txtStudentID on the form (it can be
invisible) and set its control source to

=cboDCSelect.Column(2)

and use txtStudentID as the Master Link Field.
 

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