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

Copy information from one form to another

P: n/a
I have two forms, the first is used to create quotes for our
customers, which has an autonumber field in it. The second, is an
invoice form, and needs to have the quotes' autonumber in it to keep
the two together in a sense. When the user goes from the quote form
to the invoice form, how can I create a command button to copy the
quotes' number to the invoice form?

Thanks for your help!

Rob
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
As long as the other form is still open, you can simply refer to the value of the control
holding the number.

Example:
NumberToCopy = Forms!frmFirstForm!txtAutoNumberControl

--
Wayne Morgan
"Shade" <do*************@hotmail.com> wrote in message
news:5a**************************@posting.google.c om...
I have two forms, the first is used to create quotes for our
customers, which has an autonumber field in it. The second, is an
invoice form, and needs to have the quotes' autonumber in it to keep
the two together in a sense. When the user goes from the quote form
to the invoice form, how can I create a command button to copy the
quotes' number to the invoice form?

Thanks for your help!

Rob

Nov 12 '05 #2

P: n/a
I'm sorry, I guess I should've said that the second form (invoice)
will NOT be open, and I'll need a command to copy the info, open the
next form, and paste it into said form.

Thanks Again!

Rob

"Wayne Morgan" <co***************************@hotmail.com> wrote in message news:<zO****************@newssvr17.news.prodigy.co m>...
As long as the other form is still open, you can simply refer to the value of the control
holding the number.

Example:
NumberToCopy = Forms!frmFirstForm!txtAutoNumberControl

--
Wayne Morgan
"Shade" <do*************@hotmail.com> wrote in message
news:5a**************************@posting.google.c om...
I have two forms, the first is used to create quotes for our
customers, which has an autonumber field in it. The second, is an
invoice form, and needs to have the quotes' autonumber in it to keep
the two together in a sense. When the user goes from the quote form
to the invoice form, how can I create a command button to copy the
quotes' number to the invoice form?

Thanks for your help!

Rob

Nov 12 '05 #3

P: n/a
I do it this way:
Declare a Public Variable and hold the number to be copied in that.
For example

Public intCopyNum as Integer
============================
On the first form the command button will have the following code

Function cmdCopy_Click
intCopyNum = txtAutoNumberControl
Docmd.Openform "SecondForm"
End Function

In the "SecondForm", the Load event will have
txtNumCopied = intCopyNum

HTH

Sunil Korah

do*************@hotmail.com (Shade) wrote in message news:<5a**************************@posting.google. com>...
I'm sorry, I guess I should've said that the second form (invoice)
will NOT be open, and I'll need a command to copy the info, open the
next form, and paste it into said form.

Thanks Again!

Rob

"Wayne Morgan" <co***************************@hotmail.com> wrote in message news:<zO****************@newssvr17.news.prodigy.co m>...
As long as the other form is still open, you can simply refer to the value of the control
holding the number.

Example:
NumberToCopy = Forms!frmFirstForm!txtAutoNumberControl

--
Wayne Morgan
"Shade" <do*************@hotmail.com> wrote in message
news:5a**************************@posting.google.c om...
I have two forms, the first is used to create quotes for our
customers, which has an autonumber field in it. The second, is an
invoice form, and needs to have the quotes' autonumber in it to keep
the two together in a sense. When the user goes from the quote form
to the invoice form, how can I create a command button to copy the
quotes' number to the invoice form?

Thanks for your help!

Rob

Nov 12 '05 #4

P: n/a
While you may not want it showing, it can still be open. Try hiding the form instead of
closing it by setting its Visible property to False.

--
Wayne Morgan
"Shade" <do*************@hotmail.com> wrote in message
news:5a**************************@posting.google.c om...
I'm sorry, I guess I should've said that the second form (invoice)
will NOT be open, and I'll need a command to copy the info, open the
next form, and paste it into said form.

Nov 12 '05 #5

P: n/a
Sunil,

I am kind of learning Access as I go, so do I declare that public
variable in a module? That's what I've done, I named it
modCopyBetweenForms. Should I have done this? Is there anything else
I need to do if I have that command in a Module?

Also, in your function, your line starts with 'cmdCopy_click', is that
the actual command button itself, or is that a command in Access?

Thanks for all your help!

Rob

Wayne,

What if the command button opens the second form, copies the
information, and then closes the first form? Will that work?

Thanks again!

Rob
Nov 12 '05 #6

P: n/a
Rob,

First of all, I was away for some time and saw your message only now.
So I dont know whether you found out what you needed to in the
meantime.

do*************@hotmail.com (Shade) wrote in message news:<5a**************************@posting.google. com>...
Sunil,

I am kind of learning Access as I go, so do I declare that public
variable in a module? That's what I've done, I named it
modCopyBetweenForms. Should I have done this? Is there anything else
I need to do if I have that command in a Module?
Yes, the variable has to be in a module- in the 'General' section
right at the top. But is 'modCopyBetweenForms' a module or a
vatriable?
Also, in your function, your line starts with 'cmdCopy_click', is that
the actual command button itself, or is that a command in Access?
'cmdCopy_click' is the function attached to the command button called
'cmdCopy' , which means that whenever you click on cmdCopy command
button the function 'cmdCopy_click' executes. When you go into the
code view of the form (View->Code), select 'cmdCopy' from the left
dropdownbox and 'Click' from the right side dropdown box, access
automatically names that funcion 'cmdCopy_Click' (I am mentioning this
because you say you are just learning access)

HTH
Sunil Korah
Thanks for all your help!

Rob

Wayne,

What if the command button opens the second form, copies the
information, and then closes the first form? Will that work?

Thanks again!

Rob

Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.