Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Help with an update query in Access 2003Search Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC SQL Support Forum

 New Topic 
 
 Post Reply 
[1]  
 Help with an update query in Access 2003 
 Author   Message 
  uddinz 
  
 Group: Members 
 Posts: 3 
 Joined: 2007-02-14 
 Profile
 Posted : 2007-02-14 17:02:29

My quickbooks 2006 file has approx 11,000 invoices/records in the Invoice table.  I need to reprint approx 1200 nonsequential invoices so I have created a table in access that has the 1200 invoice numbers.  I was going to join the two tables based on refnum and invoice number and update the Istobeprinted field in the invoice table to '1'.  The query runs for hours and hours and just hangs.  What optimization and/or SQL syntax should I be using.  All the invoices are post nov 06 if that is any help.

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-02-14 21:06:12

Basically you are going to need to setup a programming loop that reads each invoice number and executes:

DoCmd.RunSQL "UPDATE Invoice SET IsToBePrinted=1 where RefNumber = [invoice number variable]"

If you're saying that you just want to reprint everything after Nov'06 then you could just run this SQL Statement using VB Demo:

UPDATE Invoice SET IsToBePrinted=1 where TxnDate > {d'2006-11-30'}

 

  Top 
  uddinz 
  
 Group: Members 
 Posts: 3 
 Joined: 2007-02-14 
 Profile
 Posted : 2007-02-15 11:10:49
thanks, although i know access and sql i dont know how to do a loop.  so i am kind of stuck.  I was hoping to link tables together to run the query.  Unfortunately i am also not just trying to print all the invoices post nov, that is just an earliest date.  any resources i can look at that would give me the code for running through a table row by row and run your code? 

  Top 
  uddinz 
  
 Group: Members 
 Posts: 3 
 Joined: 2007-02-14 
 Profile
 Posted : 2007-02-15 11:31:18

does this look ok?

----------------------------

Private Sub Command5_Click()

dim rs as DAO.Recordset
dim i as long

set rs = currentdb.openrecordset(Tablename,dbOpendynaset)
rs.movelast
i = rs.AbsolutePosition

do while i >=0


DoCmd.RunSQL "UPDATE Invoice SET IsToBePrinted=1 where RefNumber = [WorkTbl]![inv#]"

rs.moveprevious
i = i - 1

loop

set rs = nothing

End Sub

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-02-15 14:23:29
This FREE QODBC support forum is limited to QODBC. If you need help with MS Access/QODBC programming, we have fee based solutions starting at A$154.00 per hour (charges apply), click here for more information. 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to