Creating a Function - error accessing file message is displayed

P

Pele

I had created a database but while trying to create a new
Function on the Modules Tab, I usually receive a message
saying "Error accessing fle, network connection may have
been lost". While troubleshooting this, I noticed that my
VBE and Database were not in sync and I was adviced to
create a blank database and reimport my objects from the
corrupted database. I have done this and the VBE is now in
sync with the database but the error message still persist
anytime I try to create this funtion. Below is the
function I was trying to create. Can somebody help me with
what I need to do to get rid of this error message.

Pele

===============FUNCTION==================================

Option Compare Database

Public Function fnDoesTableExist(Tablename) As Boolean
Dim tmp As Boolean, tbldef As Variant
tmp = False

For Each tbldef In CurrentDb.TableDefs
If tbldef.Name = Tablename Then
tmp = True
End If

Next
fnDoesTableExist = tmp
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top