Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2007
    Location
    North Carolina, US
    Posts
    32
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Connect to 2 databases with one query

    I have an Access database and an SQL database. I want to create a query that pulls from both based on a job number field. Is this possible? Thanks!

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Unfortunately, it is not possible with just 1 query.

    You will have to open 2 different connections, 1 to Access and 1 to SQL, then run 2 different queries, then combine the information together either in an array or by relating the 2 queries together.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    New Coder
    Join Date
    Jul 2007
    Location
    North Carolina, US
    Posts
    32
    Thanks
    1
    Thanked 0 Times in 0 Posts
    How would you suggest relating the two?

  • #4
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    If the queries are the same or very similar, then I would use the Recordset.GetRows(), For Next Loops, and ReDim to put your arrays together.

    GetRows() will push the recordset information into an array. ReDim along with FOR NEXT will allow you to add (or delete) items from your array.

    Check out 4guysfromrolla and asp101 for more information on working with arrays.

    Sorry I can't be more helpful, but I was just called from my desk. Once I return I will be able to help out more...
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • Users who have thanked Daemonspyre for this post:

    nbcrockett (10-09-2007)

  • #5
    New Coder
    Join Date
    Jul 2007
    Location
    North Carolina, US
    Posts
    32
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I might have found a way around it so don't waste your time. If I need more help I'll post back. Thanks!


  •  

    Posting Permissions

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