ms access - VBA code works in Access97 but not 2010 -
the 1st record in open order table matches record in bookings table no match = true happening , therefore goes down thru code anf tries insert new record. true several records in file , tries add record though there match. if set no match = false else. imported these table access 97 2010 working correctly. appreciated.
additional note: while in debug, if hover mouse on .seek "=", tempcust, temppart fields, shows 1st record in table , data in bookings table. not understanding why not matching?
sub get_current_info() docmd.setwarnings false dim rstopenord, rstbookings recordset dim tempcust, temppart, tempqty, tempdollars variant set rstopenord = currentdb.openrecordset("open orders", dbopentable) set rstbookings = currentdb.openrecordset("bookings", dbopentable) 'get open orders while not rstopenord.eof rstopenord tempcust = !odcsno temppart = !oditno tempqty = !odqtor tempdollars = !orddollars end rstbookings .index = "primarykey" .seek "=", tempcust, temppart if rstbookings.nomatch = true rstbookings .addnew !cusno = tempcust !prdno = temppart !qty_booked = tempqty !dol_booked = tempdollars !yest_qty_booked = 0 !yest_dol_booked = 0 !shipped_qty = 0 !shipped_dol = 0 .update end else rstbookings .edit !qty_booked = !qty_booked + tempqty !dol_booked = !dol_booked + tempdollars .update end end if end rstopenord.movenext loop end sub
this line suppresses information, including many types of error information ...
docmd.setwarnings false
i don't see why want @ in procedure. but, @ least during troubleshooting, make sure setwarnings
on ...
'docmd.setwarnings false docmd.setwarnings true
the point need every possible tidbit of information can while troubleshooting. don't suppress of it.
the code not expect if bookings table not include index named primarykey, or if index not include cusno , prdno (in order) first 2 keys.
but speculation. need test setwarnings
on , see whether access gives useful details.
Comments
Post a Comment