Problem with listbox

AngelicaMiranda

Registered User.
Local time
Today, 21:08
Joined
Nov 30, 2011
Messages
20
Hi !

I have a form with combo box and list box. I am able to choose StudentsID on my combo box, and whatever the studentsId i choose, it should be automatically display the profile of that student in list box...is it possible?

Do I need to use .Rowsource ?

Thanks in advance.
 
And all three fields should get displayed in the listbox?
 
And all three fields should get displayed in the listbox?

yes, for example I choose 23011 as an StudentsID in combo box, and below that combo box I have 3 textboxes which it'll automatically populates the Name, Age and Gender of that student(I don't have any problem with that), and below the textboxes, the rest of the student profile (such as course, year level etc) should be display automatically on the list box.
 
yes, for example I choose 23011 as an StudentsID in combo box, and below that combo box I have 3 textboxes which it'll automatically populates the Name, Age and Gender of that student(I don't have any problem with that), and below the textboxes,
It sounds like you have some code that should do what you're after already. Can you tell me how you did this? Perhaps show me the code too.

and below the textboxes, the rest of the student profile (such as course, year level etc) should be display automatically on the list box.
By the way, have you thought about using a subform?
 
It sounds like you have some code that should do what you're after already. Can you tell me how you did this? Perhaps show me the code too.

Hi, sorry for my late response, because I've been so busy these last days, by the way, this is my codes for combo box and textbox....

Private Sub Combo3_AfterUpdate()

Set rst = db.OpenRecordset("SELECT * FROM StudentsProfile WHERE StudentsID= '" & Me.Combo3 & "'", dbOpenDynaset)


Me.Combo3 = rst!StudentsID

Me.txtName = rst!Name
Me.txtAge = rst!Age
Me.txtGender = rst!Gender

End Sub

Private Sub Form_Load()

Set db = CurrentDb
Set rst = db.OpenRecordset("StudentsProfile", dbOpenDynaset)

Me.Combo3.RowSource = "SELECT StudentsID FROM StudentsProfile"

End Sub
 
Explain a bit more. It is required because this is school work or you don't know how else to filter your form based on criteria?
 

Users who are viewing this thread

Back
Top Bottom