checking the open state of a text file opened as a database
Posted on 2003-11-15
I am using the code below to open a csv file as a database and read records from it. Works great. The problem is, when the routine that reads the records (some 179,000 of them) is canceled the database needs to be closed, but some times, it doesn't get opened before the cancel is submitted, so when it hits the end of the sub routine it tries to close the db as normally, it would be open when the sub is done. How can I test the open state of this? you'd think that rs.state would work but it "isn't available".
Dim db As Database, rs As Recordset
Set db = OpenDatabase("X:\Zion\zms\ZMS_XCART_MAINT\", False, _
Set rs = db.OpenRecordset("PRODMAST.TXT")