Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    4

    Unanswered: Expression problem

    I have the following expression attached to a button. It is meant to Close the form it is located on (RepairAndReturnDataEntry) and open a different form (JobDetailNotes). I want this to open the 2nd form based on a field that is present on each form (JobNumber) by matching the value.

    Following is the expression:

    Private Sub Command219_Click()
    On Error GoTo Err_Command219_Click

    Dim stDocName As String

    stDocName = "JobEntryCloseJobNotesOpen"
    DoCmd.RunMacro stDocName

    Exit_Command219_Click:
    Exit Sub

    Err_Command219_Click:
    MsgBox Err.Description
    Resume Exit_Command219_Click

    End Sub


    I can do this when using the button wizard but then I lose the ability of closing the first form. I would rather not have all of the forms open. I have an expression for another button where the MainMenu remains open. That expression looks like:

    Private Sub Command14_Click()
    On Error GoTo Err_Command14_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "RepairAndReturnDataEntry"

    stLinkCriteria = "[JobNumber]=" & Me![Combo10]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_Command14_Click:
    Exit Sub

    Err_Command14_Click:
    MsgBox Err.Description
    Resume Exit_Command14_Click

    End Sub


    Is it possible to alter the above so that it not only matches the values but closes the form as well?

    Hope this is clear.

    Thanks in advance.

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8

    Re: Expression problem

    Originally posted by lab_one
    I have the following expression attached to a button. It is meant to Close the form it is located on (RepairAndReturnDataEntry) and open a different form (JobDetailNotes). I want this to open the 2nd form based on a field that is present on each form (JobNumber) by matching the value.

    Following is the expression:

    Private Sub Command219_Click()
    On Error GoTo Err_Command219_Click

    Dim stDocName As String

    stDocName = "JobEntryCloseJobNotesOpen"
    DoCmd.RunMacro stDocName

    Exit_Command219_Click:
    Exit Sub

    Err_Command219_Click:
    MsgBox Err.Description
    Resume Exit_Command219_Click

    End Sub


    I can do this when using the button wizard but then I lose the ability of closing the first form. I would rather not have all of the forms open. I have an expression for another button where the MainMenu remains open. That expression looks like:

    Private Sub Command14_Click()
    On Error GoTo Err_Command14_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "RepairAndReturnDataEntry"

    stLinkCriteria = "[JobNumber]=" & Me![Combo10]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.Close acForm, "JobDetailNotes" 'Is what you wanted
    Exit_Command14_Click:
    Exit Sub

    Err_Command14_Click:
    MsgBox Err.Description
    Resume Exit_Command14_Click

    End Sub


    Is it possible to alter the above so that it not only matches the values but closes the form as well?

    Hope this is clear.

    Thanks in advance.
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  3. #3
    Join Date
    Feb 2004
    Posts
    4
    That's exactly what I was trying to do.

    Thanks a lot!

    lab

Posting Permissions

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