Creating new record and copying value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a table("Sales Details") that has a "job no" and i want to create a
new record in another table("New Part Notification") and copy the "job no"
from "Sales Details" into a field called "ref" in "New Part ...".

Is there a simple way to do this? I have asked a similar question before and
some1 gave me some VBA code but i couldn't get it to work.

Cheers

Danny
 
Daniel Lees said:
Hi

I have a table("Sales Details") that has a "job no" and i want to create a
new record in another table("New Part Notification") and copy the "job no"
from "Sales Details" into a field called "ref" in "New Part ...".

Is there a simple way to do this? I have asked a similar question before and
some1 gave me some VBA code but i couldn't get it to work.


Hopefully, you'll get this to work. <g>

If you use OpenForm method, notice that the last argument is called
OpenArgs. You can use this argument to pass a string to the form you are
opening. For example:

Sub cmdMyButton_Click()

DoCmd.OpenForm "New Part Notification", , , , , , Me.[job no]

End Sub

Once you have the form opened, you can refer to OpenArgs as a property of
the form.

Sub Form_Open(Cancel As Integer)

Me.[ref] = Me.OpenArgs

End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top