Results 1 to 2 of 2
  1. #1
    sunny is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    15

    How to pass a data from one form two another form?

    Hi all,
    Its very important for me.Please tell me how to Pass enter data in form1 to form2.
    I am trying to enter user name in form1 and that user name i wanted to display in form2 .I am using a command button to call form2.

    please give me some solution if you know.



    thanks

  2. #2
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    There are a number of ways to pass the information from one form to another.

    if the first form is open, then in the second form you can refer to controls on the first form. ex. (in the control source of a control on the second form):

    =Forms!MyFirstForm!MyUserNameControl

    You can pass the user name to the second form in the OpenArgs parameter of the Docmd.OpenForm method. Then, in the second form OnOpen event procedure, retrieve the user name from the Me.OpenArgs property.

    You can declare a global variable in a standard module, then set the value of the global variable from the first form. Then retrieve the value in the second form using a function. Ex. (in a standard module):

    (Declarations section)
    Public gUserName as string

    (function)
    public Function fGetUserName() as string
    fGetUserName = gUserName
    end function

    ... in the control source of a control on the second form:

    =fGetUserName()

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

Similar Threads

  1. Pass data from one form to another
    By Bruce in forum Forms
    Replies: 16
    Last Post: 02-25-2013, 03:59 PM
  2. pass value from one form to another
    By ManC in forum Forms
    Replies: 7
    Last Post: 11-25-2011, 09:59 AM
  3. Pass Value to Form
    By JohnBoy in forum Programming
    Replies: 5
    Last Post: 06-06-2010, 11:26 AM
  4. Pass a value from a query to a form
    By cwwaicw311 in forum Forms
    Replies: 22
    Last Post: 03-22-2010, 10:21 AM
  5. Pass a value from a form to another
    By cwwaicw311 in forum Forms
    Replies: 3
    Last Post: 03-16-2010, 12:42 AM

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