Set the selected record in a List Box
From: Craig (Craig_at_discussions.microsoft.com)
Date: 08/28/04
- Next message: Jenny Yellman: "Creating a dataset filled with random records"
- Previous message: Stewart: "SQL Update Statement"
- Next in thread: Craig: "RE: Set the selected record in a List Box"
- Reply: Craig: "RE: Set the selected record in a List Box"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 27 Aug 2004 19:39:33 -0700
I want to use a procedure to select a particular record in a list box. I
know which record of the list box I want to select. What I'm having a
problem with is actually selecting the proper row. Access help has the
following info:
*******************************************************
Specify which row is the default value in a list box or combo box
In a form, you can specify which row is automatically selected in a list box
or combo box. This procedure does not apply to data access pages.
Open a form in Design view.
Make sure that the combo box is selected and then click Properties on the
Form Design toolbar.
In the DefaultValue property box, type [comboboxname].ItemData(n) where n is
the row that you want to use as the default. The ItemData property is
zero-based, so type ItemData(0) if you want to make the first row in the list
the default. For example, to specify the first row of the SupplierCombo combo
box as the default for the combo box, type [SupplierCombo].ItemData(0) in the
DefaultValue property box.
Note If you want to specify a default value for a lookup combo box in
Microsoft Access database (.mdb) table Design view, enter a default value in
the DefaultValue property for the foreign key. For example, if you have a
SupplierID foreign key in a Products table, click the SupplierID field, and
then enter a valid supplier ID number in the DefaultValue property box in the
lower portion of the window. The next time you add this Supplier ID field to
a form, Access automatically sets the default value for the field.
********************************************************
I've tried to set this default value but even just using the property
directly without a procedure doesn't seem to work.
Any suggestions on how to select a particular record in a list box?
Craig
- Next message: Jenny Yellman: "Creating a dataset filled with random records"
- Previous message: Stewart: "SQL Update Statement"
- Next in thread: Craig: "RE: Set the selected record in a List Box"
- Reply: Craig: "RE: Set the selected record in a List Box"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|