|
-
Aug 10th, 2005, 12:25 PM
#1
Thread Starter
Frenzied Member
ACCESS '97: Why?: Form Freezes up when setting ListBox default [RESOLVED]
Esteemed Forum Participants and Lurkers:
===============================
ACCESS '97
Why is it that when I include the following code, it freezes up my panel?
I have some buttons, checkboxes, and a list box that can be operated normally, except that EVERYTHING freezes up when the following is UNcommented:
Code:
Private Sub Form_Open(Cancel As Integer)
'Controls("cmd_DateRange").Selected(0) = True
End Sub
Note that the Form can still be moved and closed, and the proper item in the list box is selected, but all of the controls on the form are frozen.
Last edited by Webtest; Aug 10th, 2005 at 02:12 PM.
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
Aug 10th, 2005, 12:47 PM
#2
Re: ACCESS '97: Why?: Form Freezes up when setting ListBox default ???
Are you trying to set the focus to this control when the form opens.. and what control is it as it named like a command button
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 10th, 2005, 01:06 PM
#3
Thread Starter
Frenzied Member
Re: ACCESS '97: Why?: Form Freezes up when setting ListBox default ???
Danny ...
Regardless of the name, it is indeed a ListBox (I've renamed it now to "box_DateRange").
No, I'm not doing anything with the Focus ... I'm just trying to open the Form with the topmost item in this ListBox selected as the default. The user should then be able to select a different date from the list if so desired.
The selection process works ... when the Form opens the correct list item is highlighted (Item 0, 1, or 2 - I've tried it with all 3), but the form is frozen.
If I do NOT select a default in the ListBox, the form works fine and I can select any of the 3 items, operate the CheckBoxes, or operate the buttons.
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
Aug 10th, 2005, 01:48 PM
#4
Re: ACCESS '97: Why?: Form Freezes up when setting ListBox default ???
the code you need is
VB Code:
box_DateRange.Value = box_DateRange.ItemData(0)
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 10th, 2005, 02:11 PM
#5
Thread Starter
Frenzied Member
Re: ACCESS '97: Why?: Form Freezes up when setting ListBox default ???
Danny ...
I don't know how you figured that one out, but it works GREAT!
Thanks again for your gracious assistance.
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
Aug 10th, 2005, 02:14 PM
#6
Re: ACCESS '97: Why?: Form Freezes up when setting ListBox default [RESOLVED]
Simple,
ItemData refers to the list of information inside the listbox
The list box is 0 bound with -1 set for no selection.. All you needed to do was set the value (i.e List Item) to be the first item in the ItemData..
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|