Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2005
    Location
    Utah
    Posts
    136

    Talking Unanswered: IGNORE POST Open new form and close current form.

    I have a command button on a form that opens another form to a specific record. That part works great. I need the first form to close when the command button is clicked on.

    This is the code I have:

    Dim strFormName As String
    Dim strCriteria As String

    strFormName = "Patient Main Form"
    strCriteria = "[Patient ID]=" & Me![Patient ID] & ""
    DoCmd.OpenForm strFormName, acViewForm, , strCriteria

    I tried adding:

    DoCmd.Close acForm, "Patient List"

    But it's not working. I'm not sure how to do this. Any help is appreciated.

    OK, I can be a real idiot sometimes! I was using the wrong form name! Sorry!
    Last edited by Zenaida; 12-12-05 at 18:17. Reason: Figured it out.

  2. #2
    Join Date
    Nov 2004
    Posts
    64
    Try it this way

    Dim strFormName As String
    Dim strCriteria As String

    strFormName = "Patient Main Form"
    strCriteria = "[Patient ID]=" & Me![Patient ID] & ""

    DoCmd.Close acForm, "Patient List"

    DoCmd.OpenForm strFormName, acViewForm, , strCriteria



    cheers
    Peter

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by Zenaida
    I....OK, I can be a real idiot sometimes! I was using the wrong form name! Sorry!
    Does this mean you are nominating yourself for the dbForums "slaphead" of the week award?
    Last edited by healdem; 12-13-05 at 04:07.

  4. #4
    Join Date
    Sep 2005
    Location
    Utah
    Posts
    136
    Sure, do I get a trophy?

Posting Permissions

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