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

Using a Button to Open a form and Set a Default Value

P: n/a
Del
I have a form call frmMMD-PCKR. This form has seven buttons, each
button represents a part. When I click on any of the buttons they open
another form called frmTallyTagMMDPCKR.

On the frmTallyTagMMDPCKR form I have a text box called TTPartNbr

What I want to do is when I click on the button I want to set the
default value of the TTPartNbr text box.

Example:

One of the buttons is labeled 2955BLUE so when I click on that button
I want the the frmTallyTagMMDPCKR form to open and have the TTPartNbr
text box set to 2955BLUE, and if I click on the 2955RED button I want
the frmTallyTagMMDPCKR form to open and the TTPartNbr text box to be
set to 2955RED.

Thanks for any advise...

May 10 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,
In the 'OnClick' event of the button on frmTallyTagMMDPCKR I assume
you have code that says Docmd.OpenForm "frmTallyTagMMDPCKR" if so,
you can do it two ways;

add a line of code after the 'Docmd' which would be(or close to this)
Forms!frmTallyTagMMDPCKR![TTPartNbr]="2955BLUE"

or you can pass the value you want TTPartNbr to be as an 'OpenArgs'
ex; Docmd.OpenForm "frmTallyTagMMDPCKR",,,,,"2955BLUE"
then in the OnOpen event of frmTallyTagMMDPCKR you can set TTPartNbr
ex; me.TTPartNbr = Me.OpenArgs

hope it help
bobh.

On May 10, 3:14 pm, Del <dtl...@gmail.comwrote:
I have a form call frmMMD-PCKR. This form has seven buttons, each
button represents a part. When I click on any of the buttons they open
another form called frmTallyTagMMDPCKR.

On the frmTallyTagMMDPCKR form I have a text box called TTPartNbr

What I want to do is when I click on the button I want to set the
default value of the TTPartNbr text box.

Example:

One of the buttons is labeled 2955BLUE so when I click on that button
I want the the frmTallyTagMMDPCKR form to open and have the TTPartNbr
text box set to 2955BLUE, and if I click on the 2955RED button I want
the frmTallyTagMMDPCKR form to open and the TTPartNbr text box to be
set to 2955RED.

Thanks for any advise...

May 10 '07 #2

P: n/a
Del
On May 10, 4:04 pm, bobh <vulca...@isp.comwrote:
Hi,
In the 'OnClick' event of the button on frmTallyTagMMDPCKR I assume
you have code that says Docmd.OpenForm "frmTallyTagMMDPCKR" if so,
you can do it two ways;

add a line of code after the 'Docmd' which would be(or close to this)
Forms!frmTallyTagMMDPCKR![TTPartNbr]="2955BLUE"

or you can pass the value you want TTPartNbr to be as an 'OpenArgs'
ex; Docmd.OpenForm "frmTallyTagMMDPCKR",,,,,"2955BLUE"
then in the OnOpen event of frmTallyTagMMDPCKR you can set TTPartNbr
ex; me.TTPartNbr = Me.OpenArgs

hope it help
bobh.

On May 10, 3:14 pm, Del <dtl...@gmail.comwrote:
I have a form call frmMMD-PCKR. This form has seven buttons, each
button represents a part. When I click on any of the buttons they open
another form called frmTallyTagMMDPCKR.
On the frmTallyTagMMDPCKR form I have a text box called TTPartNbr
What I want to do is when I click on the button I want to set the
default value of the TTPartNbr text box.
Example:
One of the buttons is labeled 2955BLUE so when I click on that button
I want the the frmTallyTagMMDPCKR form to open and have the TTPartNbr
text box set to 2955BLUE, and if I click on the 2955RED button I want
the frmTallyTagMMDPCKR form to open and the TTPartNbr text box to be
set to 2955RED.
Thanks for any advise...- Hide quoted text -

- Show quoted text -
Thanks for the input.
I'll give both a try.

May 10 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.