Results 1 to 3 of 3
  1. #1
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    68

    How to import a field value from another form?

    I have a form (Form1) that shows a post in a table (Tbl1). There is a button that opens another form (Form2) for adding information to another table (Tbl2).



    In Form2 I want to import a field value from Form1, i.e. the ID number of the post.

    I can't find a way of doing this but I don't think this is impossible to do...

    Anyone here who knows how to do?

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    I have never done this myself. I just recently been told of this.
    try the docmd.openform using the openargs.
    Docmd.Openform "yourForm", ,,,acWindowNormal,The ID of the Post

    Dale

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Here's a step-by-step for the method rzw0wr suggested:

    In the Primary Form:
    Code:
    Private Sub Go2SecondaryForm_Click()
    
     If Nz(Me.RecordID,"") <> "" Then
      DoCmd.OpenForm "SecondaryFormName", , , , , , Me.RecordID
     Else
      MsgBox "A RecordID Must Be Entered First!"
     End If
    
    End Sub


    In the Secondary Form:

    Code:
    Private Sub Form_Load()
    
        DoCmd.GoToRecord , , acNewRec
        
        If Nz(Me.OpenArgs,"") <> "" Then
          Me.RecordID = Me.OpenArgs
        End If
    
    End Sub


    You'll need to replace Go2SecondaryForm with the actual name of your Command Button and SecondaryFormName with the actual name of your second Form and RecordID with the actual name of your Control.

    Linq ;0)>

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How do I import data into individual field?
    By ineedaccesshelp in forum Access
    Replies: 4
    Last Post: 11-28-2012, 02:41 PM
  2. Excel Import field truncation problem (to Access Memo field)
    By jhrBanker in forum Import/Export Data
    Replies: 6
    Last Post: 07-27-2012, 08:52 AM
  3. Import/Export table with field using multiselect combo box
    By celiowin in forum Import/Export Data
    Replies: 7
    Last Post: 04-04-2012, 02:25 AM
  4. Replies: 20
    Last Post: 09-06-2011, 12:39 PM
  5. Code for data import with calculated field
    By Tyork in forum Programming
    Replies: 2
    Last Post: 01-21-2011, 03:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums