473,322 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Default values on a form

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
2 1255
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: earl | last post by:
class temp { public: temp(); foo(char, char, char*); private: char matrix; }; temp::foo(char p, char o, char m = matrix )
2
by: Todd D. Levy | last post by:
I have a table of Country names & Country codes in alphabetical order. This is a lookup table that a number of other tables use to populate the Country field via a drop down Combo Box on the...
2
by: jerome g | last post by:
Hi, I'm trying to use a (simple) form to create a new record, with all values being default values coming from a previous form. My problem is that I can save that new record only if I change one...
3
by: countd4 | last post by:
I have built a working user control. However, to make it work, I always have to set certian properties using the properties sheet for the control when using it on other forms. I want to be able to...
2
by: Viorel | last post by:
Adding new row with default values. In order to insert programmatically a new row into a database table, without direct "INSERT INTO" SQL statement, I use the well-known DataTable.NewRow,...
7
by: Aaron Smith | last post by:
How do I set field default values at runtime? Say I want a check box that is bound to a boolean field to default to false for a certain set of criteria, and then true for others? I also need to do...
3
by: Charlie | last post by:
Imagine I subclass Panel into MyPanel and set a few property values to my own defaults as shown below. Eg. I set BackColor to by LightYellow. When I add MyPanel to a form, it will write the...
4
by: helenwheelss | last post by:
Access 2003, using a bound form. I'm seeing rather annoying behaviour when editing data in a control with a default value. It only happens when the form is on a new record. A specific...
4
by: Whasigga | last post by:
Hi I've created a form that has 7 subforms. It is the same subform, bound to a table, just repeated. This form represents a week, and each subform is used to enter in data for each day of the...
8
by: peterkennett | last post by:
I am designing a database that will be used by many different offices, and each office may want to change the defaults I have in a table. Rather than teach each user how to go in and change a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.