Results 1 to 3 of 3
  1. #1
    owiec is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    1

    Passing current form name to other form

    Hello,


    I got little problem with passing current form name to another form. I'm tring to execute something like this

    Form1:
    DoCmd.OpenForm "Form2", OpenArgs:="Form1"

    Form2:
    Private Sub Form_Load()

    Me.Move OpenArgs.WindowLeft, OpenArgs.WindowTop
    DoCmd.Close acForm, OpenArgs

    End Sub

    Ofcourse that doesn't work. Is there possibility to pass current form name which will work with .Parametr?

    Thanks in advance!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    Code:
    Form1:
    DoCmd.OpenForm "Form2", OpenArgs:= Me.Name
     
    Form2:
    Private Sub Form_Load()
     
    Me.Move Forms(OpenArgs).WindowLeft, Forms(OpenArgs).WindowTop
    DoCmd.Close acForm, OpenArgs, acSaveNo
     
    End Sub
    I assume you are trying to put Form1 directly over where Form1 is located.

  3. #3
    Max D's Avatar
    Max D is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2009
    Posts
    63
    You can use global variables to pass parameters. Maybe its not considered as good style, but at least it works well, especially when you need to pass several things.

    You should create a VBA Module and define global variables there to make em visible to all forms.

    By the way, isn't Form1 able to move Form2 and close itself after that?

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

Similar Threads

  1. Passing Criteria to IN statement from Form
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-09-2009, 04:02 AM
  2. Open form to current record
    By rbpd5015 in forum Access
    Replies: 1
    Last Post: 08-28-2009, 01:53 AM
  3. Replies: 0
    Last Post: 05-09-2009, 09:04 PM
  4. Passing a variable to a form
    By cjamps in forum Forms
    Replies: 0
    Last Post: 03-02-2009, 05:32 AM
  5. Replies: 1
    Last Post: 02-14-2007, 07:27 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