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

Default values on a form

P: n/a
I want to open a form using the 'on click' event of a button on an
existing form but would want a text box on the opened form to contain
the value "h7-11" as soon as it is opened. Merely setting this text
box's default value to "h7-11" on its properties is not enough as i
would like different values to appear depending on which button i
click on the existing form.

Is there any way i can use VBA code;

DoCmd.OpenForm "frmInput"
to give the text box "txtstation" the default value i require.

Thanks for any help.

Simon
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
DoCmd.OpenForm "frmInput"
forms!frmInput!txtStation = "h7-11"

--
Jeremy Wallace
AlphaBet City Dataworks
http://www.ABCDataworks.com
"Simon Bailey" <go*********@hotmail.com> wrote in message
news:1c**************************@posting.google.c om...
I want to open a form using the 'on click' event of a button on an
existing form but would want a text box on the opened form to contain
the value "h7-11" as soon as it is opened. Merely setting this text
box's default value to "h7-11" on its properties is not enough as i
would like different values to appear depending on which button i
click on the existing form.

Is there any way i can use VBA code;

DoCmd.OpenForm "frmInput"
to give the text box "txtstation" the default value i require.

Thanks for any help.

Simon

Nov 12 '05 #2

P: n/a
For a reliable way, pass the information via the OpenArgs argument of the
DoCmd.OpenForm, and pick them up in the newly-opened Form's Open event from
its OpenArgs property. OpenArgs can hold up to 80 characters of text.

Larry Linson
Microsoft Access MVP

"Simon Bailey" <go*********@hotmail.com> wrote in message
news:1c**************************@posting.google.c om...
I want to open a form using the 'on click' event of a button on an
existing form but would want a text box on the opened form to contain
the value "h7-11" as soon as it is opened. Merely setting this text
box's default value to "h7-11" on its properties is not enough as i
would like different values to appear depending on which button i
click on the existing form.

Is there any way i can use VBA code;

DoCmd.OpenForm "frmInput"
to give the text box "txtstation" the default value i require.

Thanks for any help.

Simon

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.