Solved

Access wont Compile

Posted on 2015-02-24
7
103 Views
Last Modified: 2016-02-10
I am receiving "variable Not Set" when trying to compile an Access 2010 DB.
dbfailonerror.JPG
0
Comment
Question by:seamus9909
7 Comments
 
LVL 84
ID: 40629298
Make a backup, then try to Decompile the database first. To do that, create a Shortcut with this as the Target:

"full path to msaccess.exe" "full path to your db" /decompile

Run that shortcut, then try to compile again.
0
 

Author Comment

by:seamus9909
ID: 40629341
Did that and still get the error.

Private Sub cmdTestMulti_Click()
CurrentDb.Execute "delete * from tblreportsent where [claimId]=" & Me.ClaimID, dbFailOnError
0
 
LVL 36

Assisted Solution

by:PatHartman
PatHartman earned 167 total points
ID: 40629427
Did you check for missing references?  When you have a missing reference, the first code you execute that requires a library (any library) will fail.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:seamus9909
ID: 40629790
How can I tell which library I am missing in the references?
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 167 total points
ID: 40629827
in your vba window

Tools > References

look for library  prefix with MISSING: <name of library>

uncheck this and find the available library with the same name but different version

then do DEBUG >COMPILE
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 166 total points
ID: 40631797
In addition, ...My guess is that perhaps a library may need to be loaded (in addition to a library perhaps being missing)
So you may have to add a reference to the Microsoft DAO object library perhaps...?

Also try it in a tighter syntax:
Dim strSQL as string
Dim dbs as dao.database
Set dbs=CurrentDB()
strSQL="Delete * FROM tblReportSent WHERE ClaimID=" & me.ClaimID
dbs.excecute strSQL, dbFailOnError

JeffCoachman
0
 

Author Comment

by:seamus9909
ID: 40632192
Thanks everyone, It was the DAO object library that was missing!!! Thanks so much
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question