Results 1 to 10 of 10
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Persistent Connection? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    I
    Attached Files Attached Files

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

    Re: Persistent Connection? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    The problem is that you call DoCmd.Quit twice: in the code behind frm_Menu and also in the code behind frm_DummyTable. You shouldn't quit Access from frm_Menu, but close frm_DummyTable instead. This is the modified On Click code for the "Close Form" button on frm_Menu:

    Private Sub Close_Form_Click()
    On Error GoTo Err_Close_Form_Click

    DoCmd.Close
    DoCmd.Close acForm, "frm_DummyTable", acSaveNo

    Exit_Close_Form_Click:
    Exit Sub

    Err_Close_Form_Click:
    MsgBox Err.Description
    Resume Exit_Close_Form_Click

    End Sub

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Persistent Connection? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    Hi Hans

    Thanks for the fix.

    I have a FE and BE DB setup

    I have application 1 that opens to a Switchboard and waits for the operator to open desired application form and associated records on the BE

    In another DB, I have application 2 that opens to a form with the last record from previous session displayed on the screen from the BE.

    Am I correct to assume that the Persistent Connection techinque is only valid for application 1?

    Thanks for your help

    John

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

    Re: Persistent Connection? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    It depends on how the forms work:

    Application 1:

    If the Switchboard form is bound to a table in the back end, and if it is open during the entire session in the front end, you don't need an additional persistent connection - the Switchboard will keep a connection to the back end open all the time. If the Switchboard is not bound to a table in the back end, you can use the technique of opening a recordset, as in the database you attached.

    Application 2:

    If the form you mention is open during the entire session in the front end, you don't need an additional persistent connection - the form will keep a connection to the back end open all the time. If the startup form can be closed during the session, you can use the technique of opening a recordset.

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Persistent Connection? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    Hi Hans

    Thanks for the exclamation

    In the example DB I sent, how do I get the focus to go to frm_Menu, It seems like the focus is on the hidden form frm_DummyTable when the application is opened.

    John

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

    Re: Persistent Connection? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    Press Ctrl+F6.

    Of course, what you really wanted to know is how to do it in code. No idea, SetFocus seems to have no effect.

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Persistent Connection? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    DoCmd.SelectObject might be of help.
    Charlotte

  8. #8
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Persistent Connection? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    Hi Charlotte

    To get this working, as you suggested, I adjusted frm_DummyTable as follows:

    Private Sub Form_Open(Cancel As Integer)

    Set rsAlwaysOpen = CurrentDb.OpenRecordset("tbl_DummyTable")

    Dim stDocName As String
    Dim stLinkCriteria As String

    DoCmd.RunCommand acCmdWindowHide ' hide db window on startup

    stDocName = "Switchboard"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.SelectObject acForm, stDocName, False
    DoCmd.GoToControl "[Option1]"

    End Sub

    And it didn

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Persistent Connection? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    A startup form by definition is visible. Otherwise, there wouldn't be much point in the setting.
    Charlotte

  10. #10
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Persistent Connection? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    I knew there was a logical answer.

    Thanks, John

Posting Permissions

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