G
Goobz
Hey all...
Here's the deal... I just got done building combo boxes today. They
are working 50/50 right now, and here's my problem...
cboBuildingNumber is showing the DISCTINCT Building Number
(BuildingNumber) correctly. However, when I go to populate the 2nd
field, I have absolutely nothing showing, instead of just the fields
for that specific building.
I have included the code I am using below, so hopefully someone can
make a change or two and help me figure this thing out... I know it's
probably something so damn stupid I'll be embarassed!
cboBuildingNumber = This is the main selection to populate the 2nd
combo box, and is a DISTINCT Query.
cboInBuildingLocation = This should show the information of all the
records showing the same value in "BuildingNumber" field in the table,
based on the DISTINCT query.
-----------------------------------------------------------------------------------------------------------------------------------------
Option Compare Database
' THIS IS THE UPDATE RAN AFTER THE SELECTION FOR THE CUSTOMERS
BUILDING HAS BEEN MADE '
Private Sub cboBuildingNumber_AfterUpdate()
On Error Resume Next
cboInBuildingLocation.RowSource = "Select
911Zones.InBuildingLocation " & _
"FROM 911Zones " & _
"WHERE 911Zones.BuildingNumber = '" & cboBuildingNumber.Value &
"' " & _
"ORDER BY 911Zones.InBuildingLocation;"
' Query The cboInBuildingNumber box if the building ID is changed '
Me!cboInBuildingLocation = Null
Me!cboInBuildingLocation.Requery
End Sub
' THIS IS THE UPDATE RAN TO FORCE THE COMBOS TO SYNC UP AFTER A CHANGE
TO THE BUILDING HAS BEEN MADE '
Private Sub Form_Current()
On Error Resume Next
' Synchronise Building (If Existing) with 911 Zone ID '
cboBuildingNumber = DLookup("[BuldingNumber]", "911Zones",
"[InBuildingLocation]='" & cboInBuildingLocation.Value & "'")
' Synchronise 911 Zone combo with existing 911 Zone if exists '
cboInBuildingLocation.RowSource = "Select
911Zones.InBuildingLocation " & _
"FROM 911Zones " & _
"WHERE 911Zones.BuildingNumber = '" & cboBuildingNumber.Value
& "' " & _
"ORDER BY 911Zones.InBuildingLocation;"
End Sub
' THIS IS THE SEARCH BUTTON SHOWN ON THE SCREEN '
Private Sub Search_Button_Click()
On Error GoTo Err_Search_Button_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Search_Button_Click:
Exit Sub
Err_Search_Button_Click:
MsgBox Err.Description
Resume Exit_Search_Button_Click
End Sub
' THIS IS THE UPDATE FUNCTION WHEN A USER DOUBLE CLICKS THE "LAST
UPDATED" FIELD '
Private Function SetDate()
Me.Updated = Date
End Function
Here's the deal... I just got done building combo boxes today. They
are working 50/50 right now, and here's my problem...
cboBuildingNumber is showing the DISCTINCT Building Number
(BuildingNumber) correctly. However, when I go to populate the 2nd
field, I have absolutely nothing showing, instead of just the fields
for that specific building.
I have included the code I am using below, so hopefully someone can
make a change or two and help me figure this thing out... I know it's
probably something so damn stupid I'll be embarassed!
cboBuildingNumber = This is the main selection to populate the 2nd
combo box, and is a DISTINCT Query.
cboInBuildingLocation = This should show the information of all the
records showing the same value in "BuildingNumber" field in the table,
based on the DISTINCT query.
-----------------------------------------------------------------------------------------------------------------------------------------
Option Compare Database
' THIS IS THE UPDATE RAN AFTER THE SELECTION FOR THE CUSTOMERS
BUILDING HAS BEEN MADE '
Private Sub cboBuildingNumber_AfterUpdate()
On Error Resume Next
cboInBuildingLocation.RowSource = "Select
911Zones.InBuildingLocation " & _
"FROM 911Zones " & _
"WHERE 911Zones.BuildingNumber = '" & cboBuildingNumber.Value &
"' " & _
"ORDER BY 911Zones.InBuildingLocation;"
' Query The cboInBuildingNumber box if the building ID is changed '
Me!cboInBuildingLocation = Null
Me!cboInBuildingLocation.Requery
End Sub
' THIS IS THE UPDATE RAN TO FORCE THE COMBOS TO SYNC UP AFTER A CHANGE
TO THE BUILDING HAS BEEN MADE '
Private Sub Form_Current()
On Error Resume Next
' Synchronise Building (If Existing) with 911 Zone ID '
cboBuildingNumber = DLookup("[BuldingNumber]", "911Zones",
"[InBuildingLocation]='" & cboInBuildingLocation.Value & "'")
' Synchronise 911 Zone combo with existing 911 Zone if exists '
cboInBuildingLocation.RowSource = "Select
911Zones.InBuildingLocation " & _
"FROM 911Zones " & _
"WHERE 911Zones.BuildingNumber = '" & cboBuildingNumber.Value
& "' " & _
"ORDER BY 911Zones.InBuildingLocation;"
End Sub
' THIS IS THE SEARCH BUTTON SHOWN ON THE SCREEN '
Private Sub Search_Button_Click()
On Error GoTo Err_Search_Button_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Search_Button_Click:
Exit Sub
Err_Search_Button_Click:
MsgBox Err.Description
Resume Exit_Search_Button_Click
End Sub
' THIS IS THE UPDATE FUNCTION WHEN A USER DOUBLE CLICKS THE "LAST
UPDATED" FIELD '
Private Function SetDate()
Me.Updated = Date
End Function