Populate textbox from combobox selection

S

sqlnewbie09

Need help fast. I have a form for student's courses from Monday to Friday.
There are 10 class periods for each day. Right now, I have 50 combo boxes
where they can schedule the courses for the whole week. This slows down the
loading of the form and I'm the only one using it.

I converted all of them to textbox controls and when a user clicks it a
popup form is displayed with two unbound combo boxes. First Combobox have the
value list of Monday to Friday. The second one has the available courses
(courseId, course description) which was entered from another form.

On the after update event of the second combo box:

If not isnull (Me.cboAvailableCourses) then
Forms!frmclasssched.txtbox1 = Me.cboAvailableCourses.column(0)
Docmd.close acform, "frmLoadCoursesList"
End if

This works fine and transfers the course id to the txtbox1 which is bound to
TblSchedule.

However, students wants the course description on the form and I need to
generate a report as well.

How can I display it? Should I use 2 textboxes, 1 bound and another unbound??
Also, the popup form will be used for all 50 textboxes. What would be the
best approach to my dilemma.

Any help is appreciated!!!

TIA!!!!
sqlnewbie09
 
P

Piet Linden

Need help fast.  I have a form for student's courses from Monday to Friday.
There are 10 class periods for each day.  Right now, I have 50 combo boxes
where they can schedule the courses for the whole week. This slows down the
loading of the form and I'm the only one using it.

I converted all of them to textbox controls and when a user clicks it a
popup form is displayed with two unbound combo boxes. First Combobox havethe
value list of Monday to Friday.  The second one has the available courses
(courseId, course description) which was entered from another form.

On the after update event of the second combo box:

If not isnull (Me.cboAvailableCourses) then
Forms!frmclasssched.txtbox1 = Me.cboAvailableCourses.column(0)
Docmd.close acform, "frmLoadCoursesList"
End if

This works fine and transfers the course id to the txtbox1 which is boundto
TblSchedule.

However, students wants the course description on the form and I need to
generate a report as well.

How can I display it? Should I use 2 textboxes, 1 bound and another unbound??
Also, the popup form will be used for all 50 textboxes.  What would be the
best approach to my dilemma.

Any help is appreciated!!!

TIA!!!!
sqlnewbie09

If you used a combobox with 2 columns (CourseID, CourseDescription),
you could set the width of the columns to "1;0", and that would make
the second column invisible (zero width). Then you could set any
control you wanted to

=me.cboChooseCourse.Columns(1) '<===columns are zero-based... (they
start counting from 0).
 
S

sqlnewbie09

Hi Piet,

I understand but probably I'm not clear. I do pass the course id to the
textbox and it saves fine in our server, but how do you display the course
description in an unbound textbox. Is there another way instead of using
DLookup or Elookup?? I have 50 textboxes...
 

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