I'm using MS Access 2003.
I have a cascading dropdown on a columnar form that works well except when the user cancels a record update by pressing the Escape key. Not sure where to code the cure.
DropDown #1: cmdDestinationCode
After changing the DropDown value, DropDown #2 is refreshed as follows:
DropDown #2: cmbTerminalCode (can have multiple Terminals per Destination)
The list is filtered based on the Destination selected. It has this Row Source:
When the user changes Dropdown #1, Dropdown #2 refreshes to values relevant to the new value in Dropdown #1. However, if the user then presses the Escape key to revert the record back to original state, the list in DropDown #2 does not refresh.
I tried to put the refresh code in the Form Undo event, but that didn't do it.
Any idea where I should put this code so that it fires when the user cancels the record update? It needs to refresh *after* the record has reverted.
Thanks.
Wayne
I have a cascading dropdown on a columnar form that works well except when the user cancels a record update by pressing the Escape key. Not sure where to code the cure.
DropDown #1: cmdDestinationCode
After changing the DropDown value, DropDown #2 is refreshed as follows:
Code:
Private Sub cmbDestinationCode_AfterUpdate()
On Error GoTo ErrorHandler
' Refresh the child dropdown for Terminal based on the Destination selected
Me.cmbTerminalCode.Requery
' Enable Terminal dropdown iff the Destination is selected
If Not IsNull(Me.cmbDestinationCode.Value) Then
Me.cmbTerminalCode.Enabled = True
Else
Me.cmbTerminalCode.Enabled = False
End If
' If there's only one Terminal available to select, select it
If Me.cmbTerminalCode.ListCount = 1 Then
Me.cmbTerminalCode = Me.cmbTerminalCode.ItemData(0)
Else
Me.cmbTerminalCode = vbNullString
End If
. . .
End Sub
DropDown #2: cmbTerminalCode (can have multiple Terminals per Destination)
The list is filtered based on the Destination selected. It has this Row Source:
Code:
SELECT qryDestinationAndTerminal.TerminalCode,
qryDestinationAndTerminal.TerminalName
FROM qryDestinationAndTerminal
WHERE qryDestinationAndTerminal.DestinationCode=Forms!frmCwbOrder!cmbDestinationCode
ORDER BY [TerminalCode];
When the user changes Dropdown #1, Dropdown #2 refreshes to values relevant to the new value in Dropdown #1. However, if the user then presses the Escape key to revert the record back to original state, the list in DropDown #2 does not refresh.
I tried to put the refresh code in the Form Undo event, but that didn't do it.
Any idea where I should put this code so that it fires when the user cancels the record update? It needs to refresh *after* the record has reverted.
Thanks.
Wayne