Forms and Tables

G

Guest

I have a joint table that stores both StudentID and ClassID from the Student
and Class tables. In the form (Combo box) I want to see not only the
studentID but also next to the studentID I want to see their FirstName and
LastName. In the Form I created a Combo box. It's working fine, but I don't
know which ID belongs to who??? This is why I want to see their first and
Last names next to each ID. Also, I would like to have an option to add the
student if the student is a new student. Meaning, If I don't see his or her
ID in the combo box. Any suggestions would be great. Thank you.
 
G

Guest

I'm a little puzzled, but I think you mean that you want to see both the
student ID and the name in the combo box. If that is what you meant, make
sure the necessary information is available in the combo box's row source (on
the Data tab on the combo box's property sheet). Then, at the Format tab,
set the column count to 2 (or 3, or whatever you need), and the column widths
to whatever works.
 
N

Nikos Yannacopoulos

John,

Take Bruce's advice on how to include the names in the combo display.
Now, on your other question, I'll assume you already have another form
to enter new students; I'd add a command button nect to the combo on the
form, to oepn the students form (use the wizard). Then in the students
form's Close event, I would put a couple of line of codes to requery the
combo on the original form (so it includes the new student in its
rowsource) and set its value to the new student. The code would look
something like:

Private Sub Form_Close()
Forms!frmStudentClass!cboStudentID.Requery
Forms!frmStudentClass!cboStudentID = Me.txtStudentID
End Sub

Where I have assumed the control bound to the StudentID field on the
students form to be named txtStudentID. I hope the rest of my name
assumptions are self-evident; change to the actual form and control names.

HTH,
Nikos
 

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