Advertisement

06.21.2008 at 09:00AM PDT, ID: 23504695
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.7

VBA error message - cannot find table

Asked by jhb126 in VB Script, Microsoft Excel Spreadsheet Software, SQL Query Syntax

The attached code (see attached) is a VBA code using ADO & SQL to put data from an Access table into an Excel spreadsheet. When run it returns an error message that it can't find the table (error message attached). I've checked the datadase path (see attached) and the table name (see attached) and can't figure out the problem. I'm using Office 2007 on a laptop running XP pro. I am not using the BankTable or DateFrom variables in the SQL. Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
Sub Get_Bank_ACH_Data_V2()
' Get Bank ACH Data
    Dim MyConnect As String
    Dim MyRecordset As ADODB.Recordset
    Dim MySQL As String
    Dim BankTable As String
    Dim DateFrom As Date
' Declare connection String
    MyConnect = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
    "Data Source= C:\Integration\JHB_CPA_Banking.accdb"
' Declare Bank Table
    BankTable = "TABC_Chase"
' Declare DateFrom=#03/28/2008#
' SQL Statement
    MySQL = "SELECT Bank_Number, Record, Trans_Date, Reference, Amount" & _
        " FROM TABC_Chase" & _
        " Where Trans_Date > #3/28/2008#"
'Step 4:  Instantiate and Specify your Recordset
    Set MyRecordset = New ADODB.Recordset
    MyRecordset.Open MySQL, MyConnect, adOpenStatic, adLockReadOnly
'Step 4:  Find first empty cell
     Sheets("AppendData").Select
     ACH_Data = "A" & ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row + 1
      
'Step 5:  Copy the Recordset to First Empty Row
     ActiveSheet.Range(ACH_Data).CopyFromRecordset MyRecordset
 
End Sub
Attachments:
 
Screen capture of the error message
 
 
Screen capture of the code when debug is clicked
 
 
Screen captue of Explorer showing the location of the databse
 
 
Screen capture of the Table in Access
 
 
The references selected in VBA
 
[+][-]06.21.2008 at 10:28AM PDT, ID: 21838111

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.21.2008 at 10:55AM PDT, ID: 21838162

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.21.2008 at 11:06AM PDT, ID: 21838194

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: VB Script, Microsoft Excel Spreadsheet Software, SQL Query Syntax
Sign Up Now!
Solution Provided By: zorvek
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628