By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,561 Members | 3,083 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,561 IT Pros & Developers. It's quick & easy.

parameter prompt when form opens

P: n/a
I have a listbox in the headere of a form with the details below. Once
the form's open it works properly, allowing me to select a record and
see the related details.

On opening the form, however, I get a prompt for a parameter (logically
enough) because no record is selected.

How can I automatically have it open to the first record in the
recordset?

Any pointers greatly appreciated-I'm learning this as I go along.....
TIA

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Presumably your form is based on a query, and in the Criteria row you refer
to the list box on the form.

Remove the criteria reference. Instead, use the AfterUpdate event of the
list box to move to the selected record. You can copy the code from this
link:
http://members.iinet.net.au/~allenbrowne/ser-03.html
Although the code refers to a combo box, presumably you are doing exactly
the same thing with the list box.

If you want a solution with no programming, you could create an unbound form
with the list box. The put your original form (with no listbox) in it as a
subform. Set the LinkMasterFields property of the subform control to the
name of the list box, and the LinkChildFields property to the name of the
matching field in the subform. A limitation of this approach is that the
subform shows nothing until you select a record in the listbox, which is not
what you asked for.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"P51D" <p5*********@cox.net> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
I have a listbox in the headere of a form with the details below. Once
the form's open it works properly, allowing me to select a record and
see the related details.

On opening the form, however, I get a prompt for a parameter (logically
enough) because no record is selected.

How can I automatically have it open to the first record in the
recordset?

Any pointers greatly appreciated-I'm learning this as I go along.....
TIA

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.