Results 1 to 9 of 9

Thread: Is there a way (VB/Access question)

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Is there a way (VB/Access question)

    I asked this in the VB section but thought it over and this might be a better section to get this answered. I am looking to be able to call a MSAccess Module or Macro from VB while the DB is closed. Is there a way to do this possible?
    Thanks for any help

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Is there a way (VB/Access question)

    If the database is closed, then I don't believe that anything within it is available for use. What are you trying to achieve?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Is there a way (VB/Access question)

    I want to be able to trigger an import of data, query process then export of completed data.

  4. #4
    Lively Member dbarr's Avatar
    Join Date
    Oct 2001
    Location
    Syracuse, NY
    Posts
    86

    Talking Re: Is there a way (VB/Access question)

    Here is a snippet of code I use to print an Access Report from a closed Access database:
    Reference in VB Project the Microsoft Access 9.0 Object library.

    VB Code:
    1. Dim AccessDB As Object
    2. On Error GoTo errRunAccessReport
    3.     Set AccessDB = CreateObject("Access.Application")
    4.     AccessDB.OpenCurrentDatabase strMDBNameAndPath
    5.     AccessDB.DoCmd.OpenReport strReport, 0, strFilter, strWhere
    6.     AccessDB.Quit 2 'acQuitSaveNone
    7.     Set AccessDB = Nothing

    You may be able to modify the code to run a procedure.

  5. #5
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: Is there a way (VB/Access question)

    That may work, but you're opening the database first. Access will open up.
    Besoup, do you want a way to open Access, get your report, then close it, from a VB app, like dbarr does, or is the db not supposed to be opened?
    Tengo mas preguntas que contestas

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Is there a way (VB/Access question)

    Quote Originally Posted by Besoup
    I want to be able to trigger an import of data, query process then export of completed data.
    You are not going to be able to import data into a closed database. It will have to be opened first. As salvelinus has suggested, there are ways to open it, do stuff, then close it again. I really don't see any other route you could take, and still do what you seem to need to do.

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Is there a way (VB/Access question)

    If there is a way I can open it in the backround that would work too.

  8. #8
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: Is there a way (VB/Access question)

    I don't think you can do what you want, at least w/o a lot of lower level programming in C or even ASM that I don't think is what you want.
    You may be able to access (small access) the tables w/o opening Access (here I'm not sure, but sometimes get confused between the different versions of VB I work with and stuff I've read - .Net can save dbs as XML, for instance). Either way, I'm pretty sure you can't get an Access report w/o opening Access, whether or not you can access the tables w/o opening Access.
    Tengo mas preguntas que contestas

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Is there a way (VB/Access question)

    I got it to run the visibility = false its good enough for now I guess....

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