VBA SQL Loop using QODBC

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2014-06-03T03:05:58Z Indexed on 2014/06/03 3:25 UTC
Read the original article Hit count: 206

Filed under:
|
|
|

I am trying to loop through an existing table (tblSalesOrder) and I need to run through every line (where they relate to that particular customer) and write each line into an SQL statement and execute it.

What is the easiest way to go about this procedure?

The number of lines will need to be counted prior to data being written via SQL to a QuickBooks database.

I can code something similar in php using the code below, but I am unsure how to convert this into a VBA friendly format:

$sql_count = "SELECT count(*) FROM tblSalesOrder WHERE Customer='cust_number'";
execute_query($sql_count)

When the above value is greater than 0, the vba code should loop through the queries.

Thanks everyone

© Stack Overflow or respective owner

Related posts about sql

Related posts about vba