Access Class Objects

P

Pele

I was trying to create a new function and I kept on
getting a window telling me that a report being refered to
doesn't exist anymore.

I then noticed that on the left hand side of the Modules
window, there were about 3 reports that I had deleted
awhile back still listed under the Microsoft Access Class
Object.

Can anybody tell me how I can delete tehse reports from
the module window. Note that these 3 reports don't show up
if I go into the list of reports BUT they show up in the
Modules window.

Any help will be appreciated.

Pele
 
G

George Nicholson

Have you tried compacting?

Deleting a report (or anything else) just makes it unavailable, it doesn't
physically remove it from the file. Compacting does that. I don't know why
the objects list in the vbe project window isn't "in sync" with the Database
window, but compacting would probably fix it.
 
P

Pele

George,

I have compacted the database and the VBE project window
is still not in "sync" with the database. Like I'd said,
teh reports are listed as Class Objects but the Report
list in the database doesn't show them (since I'd deleted
them awhile back).

Please let me know if you have other suggestions.

Pele
 
G

George Nicholson

OK, now it sounds like it might be a sign of corruption. I'd take a blank
database and import all my objects into it & compact again.
BTW, what version are you using?

HTH,
 
P

Pele

I am using Access 2000. Tomorrow, I will try importing all
the objects into a blank database. Thanks.

Toks
 
P

Pele

George,

I have recreated a new database by importing all the
objects from the old database. I then tried to create a
function that I needed and it still gave me an error
message (like before). It said, "Error accessing file.
Network connection may have been lost" Last time, it was
while I was trouboleshooting this particular error message
that I had noticed that the VBE and database were out of
sync.

Below is the function I was trying to enter. Any help
would be appreciated.

Pele

=======================FUNCTION===========================
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
 
G

George Nicholson

Access 2000 & that particular error message are the subject of
http://support.microsoft.com/default.aspx?scid=kb;en-us;304548
Do you have the latest Office 2000 service pack installed? (SP3, I believe)

Regarding your function, I don't see anything wrong with it per se, but I
tend to avoid looping whenever possible:

Public Function fnDoesTableExist(strTablename) As Boolean
Dim tdf as Dao.TableDef
On Error Resume Next
Set tdf = CurrentDB.TableDefs(strTableName)
If err.Number =0
fnDoesTableExist = True
Else
fnDoesTableExist = False
End If
Set tdf = Nothing
End Function

In this case you are turning error handling off and then checking to see if
an error has been raised.
If Err.Number is 0 = No error = table exists.

HTH,
 

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