Cascading Combo Boxes

draganc

New member
Local time
Yesterday, 22:33
Joined
Oct 22, 2007
Messages
2
I have a form with 2 combo boxes (cboDepartment and cboReason). The first box is a department selection and second box is a reason selection. Departments and reasons are stored in one table named tblReasons (has following columns: txtReasonID, txtReason, txtDepartment). I need to create a code that upon selection of department in cboDepartment combo-box will list reasons specific to that departement in cbo Reason combo-box and store that reason information in table named tblData in lkpReason column.

Please help.
 
I have a form with 2 combo boxes (cboDepartment and cboReason). The first box is a department selection and second box is a reason selection. Departments and reasons are stored in one table named tblReasons (has following columns: txtReasonID, txtReason, txtDepartment). I need to create a code that upon selection of department in cboDepartment combo-box will list reasons specific to that departement in cbo Reason combo-box and store that reason information in table named tblData in lkpReason column.

Please help.

http://support.microsoft.com/default.aspx?scid=kb;en-us;209576

This is a link to Microsoft support that tells you the whole thing. Just substitute their stuff for yours. :)
 
Patrick-

Thank you for your reply to this post. Link that you have provided only speaks of if I work with 2 separate tables.
 
Patrick-

Thank you for your reply to this post. Link that you have provided only speaks of if I work with 2 separate tables.

Can the tables be split? One into departments and one into reasons? Then use some sort of code to ID each department and have said code be part of the reasons table.
 
I need to create a code that upon selection of department in cboDepartment combo-box will list reasons specific to that departement in cbo Reason combo-box and store that reason information in table named tblData in lkpReason column.
Create the Cascade
Code:
Private Sub cboDepartment_AfterUpdate

  Me.cboReason.Rowsource = "SELECT tblreasons.reason FROM tblreasons " & _ 
  "WHERE table.department = [cboDepartment]"

End Sub
Insert the Value into "tblData"
Recordsource of the Form = tblData

ControlSource of cboReason = ReasonFieldFrom"tblData"

http://www.access-programmers.co.uk/forums/showthread.php?p=637091#post637091
 
Last edited:

Users who are viewing this thread

Back
Top Bottom