I am writing a VB program where when the program is started it will perform a number of deletions and calculations on an Access database table. There are therefore 4 or 5 queries listed on after the other e.g.
etc etc...
If i run my program in debug mode using F8 then everything is fine. But if I run the program normally most of the queries don't execute e.g. records are not deleted, the maths are not performed accurately etc.
Could it be that my program is running too quickly and MS Access can't keep up and so ignores the queries? If so is there a way to slow it down?
Or is there another explanation for this strange behaviour?
Many thanks
Stuart
Code:
strSQL = "DELETE purcheck.* From purcheck WHERE purcheck.[stockno] like """ & searchTerm & """ or purcheck.[stockno] is null "
Set dbfPurcheck = DBEngine.Workspaces(0).OpenDatabase(PURCHECK_PATH)
dbfPurcheck.Execute (strSQL)
'recalculate averages for Leeds
Let noMonths = DateDiff("m", #8/1/2001#, Date)
dbfPurcheck.Execute ("UPDATE purcheck SET purcheck.[avg mth] = [sales full yr]/" & noMonths & " WHERE (((purcheck.[sord stk loc])=3))")
'recalculate averages for Bolton
Let noMonths = DateDiff("m", #12/1/2001#, Date)
dbfPurcheck.Execute ("UPDATE purcheck SET purcheck.[avg mth] = [sales full yr]/" & noMonths & " WHERE (((purcheck.[sord stk loc])=2))")
etc etc...
If i run my program in debug mode using F8 then everything is fine. But if I run the program normally most of the queries don't execute e.g. records are not deleted, the maths are not performed accurately etc.
Could it be that my program is running too quickly and MS Access can't keep up and so ignores the queries? If so is there a way to slow it down?
Or is there another explanation for this strange behaviour?
Many thanks
Stuart