Simple code... but... copy & Paste

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • perryche@yahoo.com

    Simple code... but... copy & Paste

    Experts,
    Please share some light on this simple thing... I am so preplexed.
    Bascially, I am trying to copy Product Name from an open form and
    paste it to the Product Name field in Form2.


    Dim ProdNm As String

    ProdNm = Me.[ProductName]

    DoCmd.OpenForm "Form2", , , , acFormAdd

    Me![PurchaseOrdersS ubform].Form![ProductName] = ProdNm


    What did I code wrong? Why is this not working?

    Thanks in advance.
    Perry

  • Chuck Grimsby

    #2
    Re: Simple code... but... copy & Paste

    Me![PurchaseOrdersS ubform].Form![ProductName] = ProdNm

    should be:

    Forms!Form2.Pro ductName.Value = ProdNm

    Assuming that ProductName is the name of the control in Form2 that you
    want to paste the value to.

    You could also pass the value to Form2 in the OpenArgs portion of the
    OpenForm command, and then have code in the FormLoad event of Form2 to
    put it in the textbox you want.

    Comment

    Working...