Results 1 to 9 of 9

Thread: Access automation, view single object

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2001
    Location
    N42 29.340 W71 53.215
    Posts
    422

    Resolved Access automation, view single object

    I'm currently able to open an Access MDB file's objects (reports, tables, forms, etc) from a VB app, but the full-blown MDB comes up also.

    Is it possible to just open/view a single object, e.g. one report, without exposing the whole Access app?

    Here's what I'm doing now
    VB Code:
    1. Dim accApp as Access.Application
    2.        :
    3.     Set accApp = New Access.Application
    4.  
    5.     accApp.OpenCurrentDatabase (MDB_Path)
    6.     accApp.Visible = True
    7.     accApp.RunCommand acCmdAppMaximize
    8.  
    9.     accApp.DoCmd.OpenReport "my_report", acViewPreview
    10.     Set accApp = Nothing
    Feel free to make any constructive criticisms/suggestions.

    Thanks, DaveBo
    Last edited by DaveBo; Sep 30th, 2004 at 12:12 PM.
    "The wise man doesn't know all the answers, but he knows where to find them."
    VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132
    Her is a quick sample:
    VB Code:
    1. Public Sub RunAccessReport(strDB As String, strReport As String, _
    2.                            Optional strFilter As String = "", _
    3.                            Optional strWhere As String = "")
    4. '===================================================================
    5. Dim AccessDB As Access.Application
    6.  
    7.     Set AccessDB = New Access.Application
    8.     AccessDB.OpenCurrentDatabase strDB
    9.     AccessDB.DoCmd.OpenReport strReport, acViewPreview, strFilter, strWhere
    10.     AccessDB.Visible = True
    11.     Set AccessDB = Nothing
    12.  
    13. End Sub
    14.  
    15. 'usage:
    16. Private Sub Command1_Click()
    17.     RunAccessReport App.Path & "\nwind.mdb", "Catalog"
    18. End Sub

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2001
    Location
    N42 29.340 W71 53.215
    Posts
    422
    Thanks RhinoBull, but that's what I'm doing now.

    What I'm trying to avoid is having Access bring up the entire MDB,
    i.e. I just want to see the report and not the database window, switchboard etc.
    "The wise man doesn't know all the answers, but he knows where to find them."
    VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2001
    Location
    N42 29.340 W71 53.215
    Posts
    422

    Form object

    Is it possible to declare an Access form object, e.g.
    Dim accFrm As Access.Form

    then open the DB as above but without setting it visible,
    and then setting accFrm to a specific form in the Access DB
    and then just setting accFrm.Visible = True
    to just display that form?

    Thanks, DaveBo
    "The wise man doesn't know all the answers, but he knows where to find them."
    VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15

  5. #5
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    Um I spose you tried this:

    VB Code:
    1. accFrm.Visible = False

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2001
    Location
    N42 29.340 W71 53.215
    Posts
    422
    Originally posted by Dave Sell
    Um I spose you tried this:

    VB Code:
    1. accFrm.Visible = False
    It's just the one form that I want to make visible.
    i.e. keep the Access environment hidden if it has to be running at all.
    "The wise man doesn't know all the answers, but he knows where to find them."
    VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15

  7. #7
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    OK I see what youmean now. You want to have only a child MDI Form of a parent MDI Form be visible without the parent being visible?

    I don't think Windows can handle this.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2001
    Location
    N42 29.340 W71 53.215
    Posts
    422

    Bingo

    Dave, That's what I was missing here, that Access is an MDI app.
    and all those other objects are MDI child forms!

    Back to the drawing board.
    Can an Access form be imported into a VB app?

    Thanks, DaveBo
    "The wise man doesn't know all the answers, but he knows where to find them."
    VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15

  9. #9
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    Ya, I would ask this as a new thread in the general VB6 programming thread and mark this one resolved.

Posting Permissions

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



Click Here to Expand Forum to Full Width