Kdankwah
asked on
Combo Box
What I am doing is to set the dept field as a Combobox or dropdown and when you pick a dept number the segment, dept desc and segdesc is autofilled. Its not working and I don’t know what I am doing wrong? See below for specs
AfterUpdate event
Private Sub cbodept_AfterUpdate()
Me.txtDepnmdesr = Me.cbodept.Column(3)
Me.txtSegm = Me.cbodept.Column(4)
Me.txtSegdescr = Me.cbodept.Column(5)
End Sub
========================== =====
Query sql in Row source of deot cbo
SELECT [Department and Segment table].ID, [Department and Segment table].Dept, [Department and Segment table].Segment, [Department and Segment table].Dept_Desc, [Department and Segment table].Segment_Desc
FROM [Department and Segment table];
========================== =======
Data of the query in the rowsource of the dept field combox
ID Dept Segment Dept_Desc Segment_Desc
1 0701101 07000001 General Promise Programs
2 0701101 00000000 General Undefined Segment
Thanks
AfterUpdate event
Private Sub cbodept_AfterUpdate()
Me.txtDepnmdesr = Me.cbodept.Column(3)
Me.txtSegm = Me.cbodept.Column(4)
Me.txtSegdescr = Me.cbodept.Column(5)
End Sub
==========================
Query sql in Row source of deot cbo
SELECT [Department and Segment table].ID, [Department and Segment table].Dept, [Department and Segment table].Segment, [Department and Segment table].Dept_Desc, [Department and Segment table].Segment_Desc
FROM [Department and Segment table];
==========================
Data of the query in the rowsource of the dept field combox
ID Dept Segment Dept_Desc Segment_Desc
1 0701101 07000001 General Promise Programs
2 0701101 00000000 General Undefined Segment
Thanks
ASKER
Thanks, so it will be column 2,3,4. I did change that but its still not working. Should I use Onchange instead?
ASKER
I changed the afterupdate to whats below, I am getting the "txtdepnmdesr" description to work OK but the other two are not. Should I change the column to 2 and 3? I will try that and see
Private Sub cbodept_AfterUpdate()
Me.txtDepnmdesr = Me.cbodept.Column(1)
Me.txtSegm = Me.cbodept.Column(3)
Me.txtSegdescr = Me.cbodept.Column(4)
End Sub
Thanks
Private Sub cbodept_AfterUpdate()
Me.txtDepnmdesr = Me.cbodept.Column(1)
Me.txtSegm = Me.cbodept.Column(3)
Me.txtSegdescr = Me.cbodept.Column(4)
End Sub
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes and its not working. I decided to set the segment and segment description too as combobox and get the user to do the same thing as the dept and description which is working, When I do that, it works. Does it make good database sense?
Thanks
Thanks
what is the bound column of the original combo box cboDept, is it set to 1 ?
ASKER
I set it to 3. When I set it to 1 it did not work
upload a copy of the db
ASKER
ok
ASKER
can I get your email?
ASKER
Your code is referring to textboxes using different names to the textboxes that are actually on ode the form. (in other words you've either used the wrong names in your code or you have forgotten to name the textboxes properly)
ASKER
Thanks I got it to work now.
So your 5 columns are column(0) to column(4)