<>>< ><<> ><<>
<>>< ><<> ><<>
Quote:> does anyone know how to calculate the amount of checks on
> a form, in Word?
I wish for a user to clik on a text box (or hit the enter key on the text
bok) and have a modal, dialog form open up that contains a listbox control.
The user will select from the listbox, hit an OK button and return to the
main form or Hit a cancel button and return to the main form.
Everything works fine except that whenever I open the dialog form
containing the listbox I want the listbox to be in an unselected state. The
first time I open the dialog form this is the state, but every subsequent
time the dialog form is opened the initial state of the listbox is selected
with the choice made from the previous selection.
Within the dialog form I have tried to code various events that would
guarnatee that the listbox on the modal form is in an unselected state, all
to no avail. Here is the code for the mainform text box that calls the modal
DoCmd.OpenForm "frmListCategory", , , , , acDialog open as dialog
If SysCmd(acSysCmdGetObjectState, acForm, "frmListCategory") Then
'Form is still open
Me.txtCategoryName = Forms!frmListCategory!lstCategory.Column(1)
Me.txtCategoryId = Forms!frmListCategory!lstCategory.Column(0)
DoCmd.Close acForm, "frmListCategory", acSaveNo I have set
option for no save, but form retains settings
Note that I have closed the modal form with the DoCmd.Close actions.
Nonetheless the next time the form is called, neither the Load, Open,
Activate, or Get Focus events seems to be called. I have tried coding in all
Here is the code for the Modal form.
Private Sub Form_Load()
Me.lstCategory.Selected(0) = True
Me.lstCategory.Selected(0) = False
Private Sub cmdCancel_Click()
DoCmd.Close acForm, Me.FormName, acSaveNo
Private Sub cmdOk_Click()
If IsNull(lstCategory) Then
MsgBox "Please select a value, or hit Cancel to Quit"
Me.Visible = False
What event can be guaranteed to fire whenever a Modal firm is opened.