Following the guidelines to prevent cross posting inappropriately, I just want to be clear that I posted a sort of similar issue in another forum. The initial problem I had was sort of resolved, but as a result I am now running into another issue that I alluded to at the end of the other post but that is not resolved and has not been able to be resolved. I'll clarify the issue below, just wanted to point that out up front. The link is http://www.accessforums.net/showthread.php?t=63485&page=2
Details: I have 3 tables listed below.
tblClassificationTypes
ClassificationTypeID (PK)
ClassificationTypeName
tblClassifications
ClassificationID (PK)
Other fields...
ClassificationTypeID (FK)
tblIncidents
InternalIncidentID (PK)
Other fields...
ClassificationID (FK)
I have a form based on tblIncidents. On that form, I have 2 unbound combo boxes CmbType and CmbClass. CmbType displays the ClassificationTypeName and when a value is selected it requeries CmbClass to display the appropriate options. When a value is selected in CmbClass, the ClassificationID is written to tblIncidents. My issue is that when I scroll through Incident records CmbClass updates but CmbType will not update with the record change. I have tried the code below, but it does not seem to work. It runs on Form_Current (). I am open to any and all suggestions as I have been hitting me head against a wall trying to figure this out. The query in the code below returns nothing when it should return something.
Details: I have 3 tables listed below.
tblClassificationTypes
ClassificationTypeID (PK)
ClassificationTypeName
tblClassifications
ClassificationID (PK)
Other fields...
ClassificationTypeID (FK)
tblIncidents
InternalIncidentID (PK)
Other fields...
ClassificationID (FK)
I have a form based on tblIncidents. On that form, I have 2 unbound combo boxes CmbType and CmbClass. CmbType displays the ClassificationTypeName and when a value is selected it requeries CmbClass to display the appropriate options. When a value is selected in CmbClass, the ClassificationID is written to tblIncidents. My issue is that when I scroll through Incident records CmbClass updates but CmbType will not update with the record change. I have tried the code below, but it does not seem to work. It runs on Form_Current (). I am open to any and all suggestions as I have been hitting me head against a wall trying to figure this out. The query in the code below returns nothing when it should return something.
Code:
Private Sub UpdateCombo700() ' Runs when the Agency combo box is updated and shows the existing record in the AgencyIncident table for that particular InternalIncidentID '
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim stringx As String
Me.Combo700 = Empty
' I have tried this: stringx = "SELECT tblClassificationTypes.ClassificationTypeName FROM (tblClassificationTypes INNER JOIN tblClassifications ON tblClassificationTypes.ClassificationTypeID = tblClassifications.ClassificationTypeID) INNER JOIN tblIncidents ON tblClassifications.ClassificationID = tblIncidents.ClassificationID WHERE tblIncidents.InternalIncidentID = '" & Me.InternalIncidentID & "';"
' I have also tried this: stringx = "SELECT tblClassificationTypes.ClassificationTypeName FROM (tblClassificationTypes INNER JOIN tblClassifications ON tblClassificationTypes.[ClassificationTypeID] = tblClassifications.[ClassificationTypeID]) INNER JOIN tblIncidents ON tblClassifications.[ClassificationID] = tblIncidents.[ClassificationID] WHERE (((tblIncidents.InternalIncidentID)=[Forms]![frmNewMain]![InternalIncidentID]));"
stringx = "SELECT tblClassificationTypes.ClassificationTypeName FROM tblClassificationTypes INNER JOIN tblClassifications ON tblClassificationTypes.ClassificationTypeID = tblClassifications.ClassificationTypeID WHERE tblClassifications.ClassificationID = " & Me.Combo698 & ";"
Set rs = CurrentDb.OpenRecordset(stringx)
If Not rs.BOF And Not rs.EOF Then
Me.Combo700 = rs("ClassificationTypeName")
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub