Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Mar 2001
    Location
    Texas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Set connection object to CurrentDB (Access 2002)

    I'm trying to execute a query with a parameter within a form (via VB). According to what I can find in the Microsoft site, I have to have a Connection object. I'd like to point this connection object to my CurrentDB but I can't figure out how to do this.

    What I'm really going to do once I solve this problem, is run 3 queries. Each takes the same input date (hence the parameter and the need for a form). The first creates a table and the other 2 append data to this table. This table is then used in a 4th query which is called from a report. The form will ask for the date. Run the 3 queries that build the table and then run the report.

    Thanks in advance.

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set connection object to CurrentDB (Access 2002)

    From the description of your process, I would think there are better ways to accomplish the same goal. Although, it's hard to tell without more details.

    That aside, the way you refer to the current DB using ADO queries is with Currentproject.Connection

    Therefore, if you're setting an ADO Command Object's Active Connection proerty, it would look like:

    Dim cmd as New ADODB.Command
    cmd.ActiveConnection = Currentproject.Connection

    Hope this helps!

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Set connection object to CurrentDB (Access 2002)

    You could do all this with a UNION query.
    Pat <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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