rhonda6373
Registered User.
- Local time
- Today, 05:00
- Joined
- Jun 14, 2015
- Messages
- 22
First, I am a novice at Access. I have the following question:
I have a database of attorneys. The attorneys detail table has a column named section and division. Each attorney is assigned to a section and division. The divisions are a subset based on the section selected. I need to store both in the attorneys detail table. I have the combo boxes working as expected; however, I don't know how to store the values in the attorney detail table since it is an unbound field.
I have the division drop down based on the value from the sections drop down based on the following approach that I googled:
Sections table with a SectionID and SectionName
Divisions table with Division IDs associated Section ID, and Division Name
There is a SectionID and DivisionID in the attorney detail table.
There are two combo boxes on the form: cboSection and cboDivision. The record source for cboSection is:
The record source for cboDivision is:
I added the following code to the after update event for the cboSection field on the form:
Thanks!!!!!!
I have a database of attorneys. The attorneys detail table has a column named section and division. Each attorney is assigned to a section and division. The divisions are a subset based on the section selected. I need to store both in the attorneys detail table. I have the combo boxes working as expected; however, I don't know how to store the values in the attorney detail table since it is an unbound field.
I have the division drop down based on the value from the sections drop down based on the following approach that I googled:
Sections table with a SectionID and SectionName
Divisions table with Division IDs associated Section ID, and Division Name
There is a SectionID and DivisionID in the attorney detail table.
There are two combo boxes on the form: cboSection and cboDivision. The record source for cboSection is:
Code:
SELECT tblSections.SectionID, tblSections.Section
FROM tblSections;
The record source for cboDivision is:
Code:
SELECT tblSectionsDivisions.DivisionID, tblSectionsDivisions.SectionID, tblSectionsDivisions.Division
FROM tblSectionsDivisions;
I added the following code to the after update event for the cboSection field on the form:
Code:
Private Sub cboSection_AfterUpdate()
Dim sAttorneySource As String
sAttorneySource = "SELECT [tblSectionsDivisions].[DivisionID]," & _
" [tblSectionsDivisions].[SectionID]," & _
" [tblSectionsDivisions].[Division] " & _
"FROM tblSectionsDivisions " & _
"WHERE [SectionID] = " & Me.cboSection.Value
Me.cboDivision.RowSource = sAttorneySource
Me.cboDivision.Requery
End Sub
Thanks!!!!!!