Access VBA script stopped working.

I have an Access (2016) database that used to work when I clicked on a button it would export the data to an Excel spreadsheet. I created the commands in Access's VBA (I am not a VBA programmer) however now when I try to run (click on the button), I get the following error "Compile error: Can't find project or library. Here is the VBA code that I am using:

strSQL = "SELECT * FROM " & "Table_ExpenseReport" & " WHERE " & "[ID] = " & ID & ";"

It is showing that the error is on the ID part. I want this to pull the data in the ID field (cell) in the Access database and keep it as the rest of the command sends that ID's data to the Excel spreadsheet and only that ID's data. Can someone help me? I am more than happy to attach screenshots, etc. to make this work again.
Phil TukeyNetwork AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieAnalyst Assistant Commented:
Phil

In the VBE goto Tools>References... and look for anything marked as MISSING.

If you find anything take a note of its name and uncheck it.

Once you've finished close down the database, saving anything you are prompted to save.

Re-open the database and try the button again.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale FyeOwner, Developing Solutions LLCCommented:
to expand on Norie's comment.

After unchecking the item that is "MISSING" in the refernces, you will need to look through the remaining references and see if you can find a "similar" reference.

For example, you might see a reference for "Microsoft Excel 14.0 Object Library".  If that item is missing, scroll through the rest of the items in the list box and search for "Microsoft Excel ##.0 Object library", where the ## represents any number that is in the list.  If you find it, select that item and close your references, then try to compile your application.

HTH
Dale
1
Phil TukeyNetwork AdministratorAuthor Commented:
Thank you both, I was able to locate a "Missing" reference, removed the check mark, and restarted Access. That took care of the problem.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.