F
Fred Boer
Hello!
I have code which is meant to pre-load the comboboxes on my forms. The code
appears below. This has been in my application for a long time, but I just
realized now that it isn't working. I know the code will work, because I
have called the function in the immediate window with the form loaded, and
it had the desired effect on the combobox. What I *can't* seem to to is to
find an event that will work automatically.
I have tried Open, Load, Activate, and OnGotFocus, to no avail. OnCurrent
works, but not when the form initially opens, only when you navigate to a
new record. (Also, it would be silly to run this code in the current
event...).
My clumsy attempts at debugging seem to indicate that the when the code
actually fires, the active form is the calling switchboard form, not the
newly opened form...
Help!
Thanks!
Fred Boer
Function is in standard module:
Public Function fncLoadcbo()
On Error GoTo Err_fncLoadcbo
Dim i As Integer
' Cycle through the form's controls,
' testing for combo boxes,
' and pre-load each combobox.
For i = 0 To Screen.ActiveForm.Count - 1
If TypeOf Screen.ActiveForm(i) Is ComboBox Then
Dim lngDummy As Long
lngDummy = Screen.ActiveForm(i).ListCount 'Force combobox to
load all records
End If
Next
Exit_fncLoadcbo:
Exit Function
Err_fncLoadcbo:
fncWRMSErrMsg err.Number, err.Description
Resume Exit_fncLoadcbo
End Function
I have code which is meant to pre-load the comboboxes on my forms. The code
appears below. This has been in my application for a long time, but I just
realized now that it isn't working. I know the code will work, because I
have called the function in the immediate window with the form loaded, and
it had the desired effect on the combobox. What I *can't* seem to to is to
find an event that will work automatically.
I have tried Open, Load, Activate, and OnGotFocus, to no avail. OnCurrent
works, but not when the form initially opens, only when you navigate to a
new record. (Also, it would be silly to run this code in the current
event...).
My clumsy attempts at debugging seem to indicate that the when the code
actually fires, the active form is the calling switchboard form, not the
newly opened form...
Help!
Thanks!
Fred Boer
Function is in standard module:
Public Function fncLoadcbo()
On Error GoTo Err_fncLoadcbo
Dim i As Integer
' Cycle through the form's controls,
' testing for combo boxes,
' and pre-load each combobox.
For i = 0 To Screen.ActiveForm.Count - 1
If TypeOf Screen.ActiveForm(i) Is ComboBox Then
Dim lngDummy As Long
lngDummy = Screen.ActiveForm(i).ListCount 'Force combobox to
load all records
End If
Next
Exit_fncLoadcbo:
Exit Function
Err_fncLoadcbo:
fncWRMSErrMsg err.Number, err.Description
Resume Exit_fncLoadcbo
End Function