Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2002
    Posts
    173

    Unanswered: can someone look at my code

    I'm using the following code on a button to automatically print off a report and some other forms. When the user is finished the main database window is open(when it should remain hidden and is set to "hidden" using the startup options). Is there any way to keep the database window to remain hidden?

    Private Sub Command158_Click()
    On Error GoTo Err_Command158_Click

    Dim stDocName1 As String
    stDocName1 = "PAY FINAL INVITATION REPORT COST ANALYSIS"
    DoCmd.OpenReport stDocName1, acNormal

    Dim stDocName2 As String
    Dim MyForm2 As Form
    stDocName2 = "frmform2"
    Set MyForm2 = Screen.ActiveForm
    DoCmd.SelectObject acForm, stDocName2, True
    DoCmd.PrintOut
    DoCmd.SelectObject acForm, MyForm2.Name, False

  2. #2
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    put this code at the end of your button
    DoCmd.SelectObject acTable, , False

    let us know
    Jim

  3. #3
    Join Date
    Jun 2002
    Posts
    173
    I tried it out but it didn't work. It leaves the following error message though:

    "This action requires an Object Name argument"

    I'm running Access97 if this makes any difference to the code.

  4. #4
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    this is the code that i used to unhide the window

    Private Sub ShowDBWindow_Click()
    DoCmd.SelectObject acTable, , True
    DoCmd.ShowToolbar "Database", acToolbarWhereApprop
    DoCmd.ShowToolbar "Form View", acToolbarWhereApprop
    DoCmd.ShowToolbar "Formatting (Form/Report)", acToolbarWhereApprop


    End Sub

    the show toolbar comands are self explanitory.
    try to look up the selectobject method of the docmd, maybe it will help
    Jim

  5. #5
    Join Date
    Jun 2002
    Posts
    173
    I tried the following and it works now. Thanks for the help!

    Docmd.SelectObject acTable, , True
    Docmd.RunCommand acCmdWindowHide

Posting Permissions

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