VBA SQL Loop using QODBC -


i trying loop through existing table (tblsalesorder) , need run through every line (where relate particular customer) , write each line sql statement , execute it.

what easiest way go procedure?

the number of lines need counted prior data being written via sql quickbooks database.

i can code similar in php using code below, unsure how convert vba friendly format:

$sql_count = "select count(*) tblsalesorder customer='cust_number'"; execute_query($sql_count) 

when above value greater 0, vba code should loop through queries.

thanks everyone

you need record set execute , store query result.

dim sql_count string dim rs adodb.recordset set rs = new adodb.recordset 

you need connection database connection. "cn" storing connection quickbooks.

sql_count = "select count(*) tblsalesorder customer='cust_number'" set rs = cn.execute(sql_count)  while rs.fields(0).value > 0 ' rs.fields(0) should count(*) ' codes loop 

for connection string quickbooks, read here


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -