Hi everyone,
In my current database, I have a table named tblIncidents asthe table behind my main form. My main data entry form is based on the Incident#(the PK for tblIncidents). In most cases, all tables are related to this onevia associative tables to resolve the many to many relationship issue. However,I have one table that is one relationship further away from tblIncidents.Please see the attachment for the table layout.
I have a cboClassType that allows me to selectClassificationType which filters my next cboClassName and allows me to choose aClassificationName that falls under the selected type. As I scroll through myrecords, I can get cboClassName to update but not cboClassType because myrecords are based off of InternalIncidentID which is not present intblClassificationTypes.
I am at a loss how to get both cbos to update as I scrollthrough records based on tblIncidents. My current code that works for cboClassName is below. Is there a way I can adapt that or do a JOIN so that I can get cboClassType to update as the record changes? Any help would be much appreciated!!!
Code:Private Sub UpdatecboClassName() ' Runs when the Classification combo box is updated and shows the existing record in the IncidentClassifications table for that particular InternalIncidentID ' Dim db As DAO.Database Dim rs As DAO.Recordset Dim strSQL As String Me.cboClassName.Value = Empty strSQL = "SELECT [tblIncidentClassifications].[ClassificationID]" strSQL = strSQL & " FROM tblIncidentClassifications" strSQL = strSQL & " WHERE tblIncidentClassifications.InternalIncidentID = '" & Me.InternalIncidentID & "';" ' Debug.Print strSQL Set rs = CurrentDb.OpenRecordset(strSQL) If Not rs.BOF And Not rs.EOF Then Me.cboClassName = rs("ClassificationID") End If rs.Close Set rs = Nothing Set db = Nothing End Sub