Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening a form and setting it's record source (Access 2003 )

    I know I've done this before but for the life of me I can't figure out how to make this work. I want to open a form (form2) from another form (form1) and then set the recordsource for form2 once it's open. I know I've done this in the past out it escapes me now. Thanks for the help..

    Docmd.Open "Form2".recordsource = form2_qry

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Opening a form and setting it's record source (Access 2003 )

    To open a form, you must use DoCmd.OpenForm, not DoCmd.Open.
    And if you want to change the record source, you must do that in the On Open event of the form you are opening

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening a form and setting it's record source (Access 2003 )

    Your right Hans. I typed it wrong. How would the on open event look on form2. I tried using what below but it didn't work..

    'Forms!form2.RecordSource = form2_qry

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Opening a form and setting it's record source (Access 2003 )

    The RecordSource property is a string, so you must use

    ... = "form2_qry"

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening a form and setting it's record source (Access 2003 )

    Ohh Man. That was it. Thanks Hans. Blame it on Monday...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •