well, i have to wonder why your user doesn't just write her as hoc queries
and reports into a separate frontend. then your revised "official" frontend
can overwrite the obsolete version without issue.
hth
tina
Thank you very much.
This is part of a larger process I was writing. Here is a brief
explanation of my story. I'll probably repost this so, maybe you
don't need to read.
This db is a database that tracks sales information, the back end is
SQL, and the front end is plane jane access, 2002, and most of the
clients run the db with the stripped down runtime executable.
I have one user who makes changes to her front end of the sales
database. When I make changes to the database, Which I do all the
time since It's pretty much my database. Okay, when I release an
update, and she overwrites her old one, she loses all her queries and
Reports. She doesn't seem to create macros or tables.
Luckily, all of her objects are prefixed with the name "Cindy."
So, you can see how the isfound() fits in with all of this, I can't
import that report/query if it's already there or I'll get a 1.
Well, now the program is starting to barf because it can't get read
access to Msysobjects in a database that isn't the current one. I
did...
dim fDB as database
set fDb = "C:\accessxp\sales\salesold.mdb"
set rst = db.openrecordset("msysobjects")
and it gets upset right there when it tries to open the other
database's msysobjects saying it doesn't have read permission.
any help?
Thanks again Tina.
-Brian P.
Best Data Processing - Holiday, FL
you can't use the NoMatch property because you didn't use a Seek or Find
method on the open recordset. remember, you're already opening a filtered
recordset, so you only need to see if a record was returned. also, Exists
may be a reserved word, suggest you rename the procedure. try the
following,
as
Public Function isFound(ByVal objectName As String) As Boolean
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim str As String
str = "SELECT MSysObjects.Name FROM MSysObjects " _
& "WHERE MSysObjects.Name = '" & objectName & "'"
Set db = CurrentDb
Set rst = db.OpenRecordset(str, dbOpenDynaset)
isFound = Not (rst.BOF And rst.EOF)
rst.Close
Set rst = Nothing
End Function
when a recordset is empty, both BOF and EOF are True. in that case, the
object was not found, so we want to report False, so we "flip" the return
value using Not.
hth
tina
This is my attempt at an exists() function, I can't seem to find one
that will tell me if a given name, exists, as a table, or query, or
report. I Don't even need to search tables, but the only other
routines I have seen search tabledef anyway!! Here goes. (Sorry if
I've double-posted this, I can't find my first post!)
Public Function eXists(objectName As String) As Boolean
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
' Set rst = db.OpenRecordset("select * from [msysobjects] where
([name] = """ & objectName & ")")
Set rst = db.OpenRecordset("select * from [msysobjects] where
[msysobjects].[name] = """ & objectName & """")
' "cindyrpt - 336 mailing label Listing - all contacts"
If rst.NoMatch Then
eXists = False
Else
eXists = True
End If
End Function- Hide quoted text -
- Show quoted text -