Results 1 to 7 of 7
  1. #1
    Banshee is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Posts
    4

    Displaying Form Data on another Form

    Hi everyone.



    I've created two forms, a button on the main form opens the second one. The second form asks for a number, the measurement used for the number and two other pieces of information just needed for that form. The first two pieces of information I want to have displayed on the main form but I cannot seem to figure out how to do it.

    Thanks in advance!

  2. #2
    mcktigger is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    19
    Hi Banshee

    If I understand this correct you want to transfer info from form1 to form2 when you click cmdbutton?

    If so on the click event of the command button after the Docmd.openform xxxxxx

    Forms!Form2!fieldNumber = me.fieldnumber
    Forms!Form2!fieldMeasurement = me.fieldmeasurement

    This assumes form1 is still open when form2 is opened.

  3. #3
    Banshee is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Posts
    4
    Hello mcktigger,

    Not quite, I want the two of the choices made on form 2 to appear on form 1 when it closes. Sorry I didn't make sense the first time!

  4. #4
    mcktigger is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    19
    hi

    assuming form1 is always open when form2 is open you could put this code on the On Close event on form2:

    Forms!form1!field1 = Forms!form2!field1
    Forms!form1!field2 = Forms!form2!field2

    You could also put this on the On Click event of the cmdbutton

    Hope this helps

  5. #5
    Banshee is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Posts
    4
    That's pretty much got it, the code works perfectly but I'm an awkward person and want both fields 1 and 2 on form 2 to go into one field on form 1... I can't help being a pest!

  6. #6
    mcktigger is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    19
    hi

    On the On Close event put the following

    Dim strfield As String (creates a variable to temporary hold field1 & field2)

    strfield = Me.Field1 & " " & Me.Field2 (puts the data into the variable)
    Forms!frmForm1!Field1 = strfield (transfers the variable to form field1)

    Note: if no space is needed then take out " "&

    hope this helps

  7. #7
    Banshee is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Posts
    4
    mcktigger

    I love you


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

Similar Threads

  1. Replies: 1
    Last Post: 11-12-2010, 06:33 PM
  2. Replies: 1
    Last Post: 11-07-2010, 11:04 AM
  3. Form not displaying source table data
    By Sarge, USMC in forum Forms
    Replies: 6
    Last Post: 10-25-2010, 07:36 AM
  4. Displaying unrelated data on a form
    By FadingAPE in forum Forms
    Replies: 1
    Last Post: 10-06-2010, 10:33 AM
  5. Displaying a PDF in a Form
    By Chaz in forum Forms
    Replies: 0
    Last Post: 08-07-2006, 03:26 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