Solved Row Source Column (1 Viewer)

swingline

Member
Local time
Today, 02:09
Joined
Feb 18, 2020
Messages
51
I have a combo boxed with this query as the row source.
SQL:
SELECT tblApprovedCourses.CourseName, tblApprovedCourses.NumberTD, tblApprovedCourses.CourseID FROM tblApprovedCourses;

I have an after update set to

Code:
Private Sub CourseName_AfterUpdate()
Me.NumTD.Value = Me.CourseName.Column(1)
Me.CourseID.Value = Me.CourseName.Column(2)
End Sub

The issue Im running into is that Column(2) isn't outputting anything thing to the desired text box. When I look at the query in the datasheet view its populated with the correct values.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:09
Joined
May 7, 2009
Messages
19,237
what Data type is CourseID, numeric?
if so you need to Cast Column(2) as Long:

Me.CourseID.Value = Clng(Me.CourseName.Column(2))
 

swingline

Member
Local time
Today, 02:09
Joined
Feb 18, 2020
Messages
51
CourseID is text
 

swingline

Member
Local time
Today, 02:09
Joined
Feb 18, 2020
Messages
51
Got it working. I needed to change the format of the combo box

Column Count 3
Column Widths 2.5";0";0"
 

Users who are viewing this thread

Top Bottom