Advertisement

05.15.2008 at 07:53AM PDT, ID: 23405370
[x]
Attachment Details

Excel VBA - SQL Query applying Date Limit not following properly. (Quickbooks)

Asked by mdadnan in Microsoft Excel Spreadsheet Software, Quickbooks Financial Software, Access Coding/Macros

Tags: Microsoft, Excel VBA, Quickbooks, 2007, using SQL Query

Hi,

I am running an SQL query which is fetching data from Quickbooks a bit earlier then defined starting date limit and a bit further from defined ending date.

Could it be a problem in quickbooks or am I doing it wrong?

I have defined variables as String and picking date information from cells usiing =Today()

Using following query, data is picked between dates 11th April and 23rd May.

Thanks!

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
DateFrom = format(Sheets("User").Range("I22").Value, "yyyy-mm-dd")
DateTill = format(Sheets("User").Range("I14").Value, "yyyy-mm-dd")
 
sSQL = "SELECT InvoiceLine.TxnDate, InvoiceLine.InvoiceLineItemRefFullName, InvoiceLine.InvoiceLineQuantity  FROM InvoiceLine InvoiceLine WHERE (InvoiceLine.TimeCreated>={ts '" & DateFrom & " 00:00:00.000'} And InvoiceLine.TimeCreated<={ts '" & DateTill & " 00:00:00.000'}) ORDER BY InvoiceLine.TxnDate"
 
Set oConnection = New ADODB.Connection
Set oRecordset = New ADODB.Recordset
[+][-]05.16.2008 at 01:51AM PDT, ID: 21580973

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 02:06AM PDT, ID: 21581064

View this solution now by starting your 7-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: Microsoft Excel Spreadsheet Software, Quickbooks Financial Software, Access Coding/Macros
Tags: Microsoft, Excel VBA, Quickbooks, 2007, using SQL Query
Sign Up Now!
Solution Provided By: mdadnan
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628