Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7940519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:24:48+00:00 2026-06-03T23:24:48+00:00

Using primarily the macro recorder, I created a VBA macro that sets up a

  • 0

Using primarily the macro recorder, I created a VBA macro that sets up a Vendor list connection between Excel and a QuickBooks file.

Sub RefreshVendorList()
'
' RefreshVendorList Macro

'DatabaseName=3ae39a3bfa964f61a6f974654c1ddbe9;

Columns("C:E").Select
Selection.Delete Shift:=xlToLeft

With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array(Array( _
    "ODBC;Driver={QB SQL Anywhere};UID=Purchasing;;ServerName=QB_data_engine_21;AutoStop=NO;" _
    ), Array("Integrated=NO;Debug=NO;DisableMultiRowFetch=NO")), Destination:= _
    Range("$C$1")).QueryTable
    .CommandText = Array( _
    "SELECT v_lst_vendor.name AS 'Vendor Name', v_lst_vendor_type.name AS 'Type', v_lst_vendor.is_hidden" & Chr(13) & "" & Chr(10) & "FROM QBReportAdminGroup.v_lst_vendor v_lst_vendor, QBReportAdminGroup.v_lst_vendor_type v_lst_vendo" _
    , _
    "r_type" & Chr(13) & "" & Chr(10) & "WHERE v_lst_vendor_type.id = v_lst_vendor.vendor_type_id AND ((v_lst_vendor.is_hidden=0) AND (v_lst_vendor_type.name='MBO'))" & Chr(13) & "" & Chr(10) & "ORDER BY v_lst_vendor.name, v_lst_vendor_type.name" _
    )
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .PreserveColumnInfo = True
    .ListObject.DisplayName = "Table_PA_Vendor_List"
    .Refresh BackgroundQuery:=False
End With

'delete the "ishidden" column
Columns("E:E").Delete

End Sub

I attached the code to a button so the user can update the vendor list. With the QuickBooks file open, this snippet works most of the time. This is what I would like to change, and there are two way I think it could be accomplished:

Option 1. Every time the button is pressed (and the ODBC connection is re-created), it asks the user for the password. I would like to pass the password instead of asking the user. Changing .SavePassword to True doesn’t do it.

Option 2. I think there is a better way to set up the ODBC connection so it doesn’t have to be “re-created” by a macro just to refresh it. As long as QuickBooks and this Excel file stay open, I am able to use the built-in refresh button in Excel (under Data -> Refresh All). However, if I close the Excel file and the QuickBooks file, re-open them and try pressing refresh, I get the following error, which is the reason I created a macro to re-create the ODBC connection:

Database not found ODBC error

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:24:49+00:00Added an answer on June 3, 2026 at 11:24 pm

    You are using the custom reporting ODBC driver. This is provided by QuickBooks for reporting purposes only. You can only used this while the company file is open, and you must enter a password for the reporting user whenever you connect. That’s the way Intuit designed it to work.

    It would be possible to write VBA code to create and hold open the ODBC connection so that you didn’t have to go through the log in process more than once per session. However, this is not just a snippet of code to copy; you’d have to have a global variable for the connection and manage it properly.

    A simpler solution would be to use the QODBC driver instead of the custom report driver. I believe you get a copy of this bundled with QuickBooks Enterprise. I’m assuming you have the Enterprise edition, since you have custom reporting. QODBC takes some setup, but once it’s set you should be able to avoid the login prompt and get a consistent connection to the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ExcelDNA/C#/Excel primarily. What I am essentially trying to do is convert
I was wondering if users that are using Kohana primarily to explain how they
I am using WCF RIA services with silverlight. Obviously I am using this primarily
I created a site using drupal 6.I want to show primary menu items only
i have read in more then one place that using NHibernate's Identifier as Primary
So my web application is primarily using XML for client to server interaction and
I'm a .NET Developer, primarily using c#, asp.net mvc, entity framework and programming for
Im primarily using Hibernate to reduce the memory consumption of my application because I
Using a jQuery plugin named touchswipe ( Touchswipe http://labs.skinkers.com/touchSwipe/ ) for a website primarily
Using Rob Conery's Massive micro-ORM; is it possible to work with tables that have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.