Macros and Programming


CardboxForumsMacros and Programming > "Checking for already opened database"

Checking for already opened database

Posted By Post

Herman B

15-Aug-2005 00:29

How can I check if a database is already open before opening it from a macro, so there will not be two windows on this database? I've been trying, but can't figure it out.

Paul Irvine

23-Aug-2005 18:01

Below is a simple function that checks if a database is already open in Cardbox, and opens the database if it is not.

Function OpenDatabase(dbname)
 dim db ' a Cardbox database object
 on error resume next
 set db=Windows(dbname)
 If err<>0 then
   OpenFile "cardbox://your server ip goes here/"+dbname
 End If
End Function

OpenDatabase("database name goes here")

© 2010 Cardbox Software Limited   Home