PC Review


Reply
Thread Tools Rate Thread

Update table based on combo box selection

 
 
=?Utf-8?B?ZHdheW5lc3dvcmxkMDEz?=
Guest
Posts: n/a
 
      14th Apr 2006
I currently have a form where the user selects a course from a combo box.
After selecting the course, the course hours are stored in the underlying
table. I would like for additional information to be stored in the table
also but whenever I enter information into the form , the additional
information is not populating. This is the code that I am using:

Private Sub Course_Name_AfterUpdate()
Me.[Course Hours] = Me.[Course Name].Column(2)
Me.[New Hire Course] = Me.[Course Name].Column(3)
Me.[Cust Satisfaction Course] = Me.[Course Name].Column(4)
Me.[Technical/Skill Building Course] = Me.[Course Name].Column(5)
End Sub

All if the above information is coming from a Select query:

SELECT tblCourseData.[Course ID], tblCourseData.[Course Listing],
tblCourseData.[Course Hours], tblCourseData.[New Hire Course],
tblCourseData.[Cust Satisfaction Course], tblCourseData.[Technical/Skill
Building Course] FROM tblCourseData ORDER BY tblCourseData.[Course Listing];

Can anyone help me?

 
Reply With Quote
 
 
 
 
Al Camp
Guest
Posts: n/a
 
      14th Apr 2006
Your combo should be bound to CourseID, with
ColumnCount of 6
ColumnWidths set to 0";1";1";1";1";1" (ex. widths)

That will "store" CourseID in the bound combo field, but "display" the CourseListing
in the combo box.

Otherwise, it looks OK... if you can see the data in the columns, and each row has a
unique Course ID, it should present those values to the form on AfterUpdate.

But...
There's no need to save the "ancillary values" to a table field, like... CourseHours
or NewHireCourse etc...
All you really need to capture is the Course ID in your combo, and the other values
can be "calculated" from that.

ex. field CourseHours with ControlSource of...
=Me.[Course Name].Column(2)
will always "display" the correct value... no need to save it. All the ancillary info can
be "re-derived",
on the fly, in any subsequent query form or report.

Never save a value that can be derived from data you already have.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



"dwaynesworld013" <(E-Mail Removed)> wrote in message
news:F738981E-9F59-493E-A33C-(E-Mail Removed)...
>I currently have a form where the user selects a course from a combo box.
> After selecting the course, the course hours are stored in the underlying
> table. I would like for additional information to be stored in the table
> also but whenever I enter information into the form , the additional
> information is not populating. This is the code that I am using:
>
> Private Sub Course_Name_AfterUpdate()
> Me.[Course Hours] = Me.[Course Name].Column(2)
> Me.[New Hire Course] = Me.[Course Name].Column(3)
> Me.[Cust Satisfaction Course] = Me.[Course Name].Column(4)
> Me.[Technical/Skill Building Course] = Me.[Course Name].Column(5)
> End Sub
>
> All if the above information is coming from a Select query:
>
> SELECT tblCourseData.[Course ID], tblCourseData.[Course Listing],
> tblCourseData.[Course Hours], tblCourseData.[New Hire Course],
> tblCourseData.[Cust Satisfaction Course], tblCourseData.[Technical/Skill
> Building Course] FROM tblCourseData ORDER BY tblCourseData.[Course Listing];
>
> Can anyone help me?
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?ZHdheW5lc3dvcmxkMDEz?=
Guest
Posts: n/a
 
      14th Apr 2006
Thanks. I did not have my columncount set correctly. Also, thanks for the
suggestion concerning storing values. The reason for this is that the values
change depending on participant information. I appreciate it!!

"Al Camp" wrote:

> Your combo should be bound to CourseID, with
> ColumnCount of 6
> ColumnWidths set to 0";1";1";1";1";1" (ex. widths)
>
> That will "store" CourseID in the bound combo field, but "display" the CourseListing
> in the combo box.
>
> Otherwise, it looks OK... if you can see the data in the columns, and each row has a
> unique Course ID, it should present those values to the form on AfterUpdate.
>
> But...
> There's no need to save the "ancillary values" to a table field, like... CourseHours
> or NewHireCourse etc...
> All you really need to capture is the Course ID in your combo, and the other values
> can be "calculated" from that.
>
> ex. field CourseHours with ControlSource of...
> =Me.[Course Name].Column(2)
> will always "display" the correct value... no need to save it. All the ancillary info can
> be "re-derived",
> on the fly, in any subsequent query form or report.
>
> Never save a value that can be derived from data you already have.
> --
> hth
> Al Camp
> Candia Computer Consulting - Candia NH
> http://home.comcast.net/~cccsolutions
>
>
>
> "dwaynesworld013" <(E-Mail Removed)> wrote in message
> news:F738981E-9F59-493E-A33C-(E-Mail Removed)...
> >I currently have a form where the user selects a course from a combo box.
> > After selecting the course, the course hours are stored in the underlying
> > table. I would like for additional information to be stored in the table
> > also but whenever I enter information into the form , the additional
> > information is not populating. This is the code that I am using:
> >
> > Private Sub Course_Name_AfterUpdate()
> > Me.[Course Hours] = Me.[Course Name].Column(2)
> > Me.[New Hire Course] = Me.[Course Name].Column(3)
> > Me.[Cust Satisfaction Course] = Me.[Course Name].Column(4)
> > Me.[Technical/Skill Building Course] = Me.[Course Name].Column(5)
> > End Sub
> >
> > All if the above information is coming from a Select query:
> >
> > SELECT tblCourseData.[Course ID], tblCourseData.[Course Listing],
> > tblCourseData.[Course Hours], tblCourseData.[New Hire Course],
> > tblCourseData.[Cust Satisfaction Course], tblCourseData.[Technical/Skill
> > Building Course] FROM tblCourseData ORDER BY tblCourseData.[Course Listing];
> >
> > Can anyone help me?
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable Combo Box based on Selection of 1st Combo box =?Utf-8?B?R2Vvcmdl?= Microsoft Access Form Coding 3 24th Apr 2007 04:34 PM
Populate one combo box based on the selection of another combo box =?Utf-8?B?QWxleA==?= Microsoft Excel Programming 8 19th Apr 2007 06:40 PM
combo box list based on the selection in another combo box =?Utf-8?B?TWFyaWFubmU=?= Microsoft Access Form Coding 3 11th May 2006 06:35 PM
populating a combo box based on selection in another combo box Brian Beck Microsoft Access Form Coding 5 8th Feb 2006 01:25 PM
filtering combo box entries based on the selection of another combo box JulieD Microsoft Access Forms 1 4th Nov 2003 10:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:07 AM.