Results 1 to 3 of 3

Thread: Requery?

  1. #1
    New Lounger
    Join Date
    Aug 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    I have a problem with opening a form from another form; the new form opens before the record on the first form has saved.

    Below is the code I am using:

    Private Sub OpenEnviroIndex_Click()
    On Error GoTo Err_OpenEnviroIndex_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmEnviroIndex"
    DoCmd.Save
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.Close acForm, "frmMainEnviro", acSaveYes



    Exit_OpenEnviroIndex_Click:
    Exit Sub

    Err_OpenEnviroIndex_Click:
    MsgBox Err.Description
    Resume Exit_OpenEnviroIndex_Click

    End Sub


    Any ideas?!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Welcome to the Lounge!

    The line

    DoCmd.Save

    does not save the current record, but the design of the form. To save the current record, replace it with

    RunCommand acCmdSaveRecord

  3. #3
    New Lounger
    Join Date
    Aug 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi there,

    Thank you very much for your help, it works!


Posting Permissions

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