Hello,
I am building a revenue projection system in Excel VBA that is powered by Access DAO. This is my first Access project in VBA.
It currently takes all of the sales information, runs it through a bunch of query tables, which the code creates, and then walks through the various query tables and creates the final revenue table.
I use the following sort of logic to test for tables existence, to delete if it exists and rebuild, or to simply create if it does not exist:
Code:
test = db.TableDefs(qryNm).Name
If Err Then
strSQL = ""
qd.Sql = strSQL
Else
DBEngine(0)(0).QueryDefs.Delete qryNm
strSQL = ""
qd.Sql = strSQL
End If
This was the only querytable test that I was able to find after some searching, which relies on an 'on error resume next' to execute it. The problem is that it does not seem to reliably accomplish what I need. Sometimes tables are not deleted, even though they are there or sometimes the tables randomly claim there are circular references, yet running the code again, or a few more times, will fix it (The SQL itself works fine).
The idea behind this entire project is that the user will not have to interact with Access at all, all of the end results will flow to Excel, but I am having serious concerns about the methodology in which I am going about this.
Anyone have any comments or help?
Thanks.