[dba-Tech] Problems with dbReadOnly option

Jim Lawrence accessd at shaw.ca
Tue Mar 11 22:21:59 CDT 2008


Without looking carefully into the issue you should note the parameters have
a set of defaults if no value is stated and each of the parameters just
translate to a numeric value. Example; and I am just substituting guess
values as the real value will differ:

dbOpenDynaset is a value of 2 (this is from memory...)
dbReadOnly is a value of 4
...and a space might have a default value of 4.

There might be spaces for 5 parameter values and as long as the values fall
within their appropriate positions, are appropriately a 'string' or
'numeric' and within the range of values expected, things will work but not
necessarily as you expect.

I.E.: Set rst = DBEngine(0)(0).OpenRecordset(stg, 2, 4) ' Is the same as:
Set rst = DBEngine(0)(0).OpenRecordset(stg, dbOpenDynaset, dbReadOnly) 

Just as CurrentDb() is the same as DBEngine(0)(0)  

HTH
Jim

-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Tuesday, March 11, 2008 6:12 PM
To: 'Discussion of Hardware and Software issues'
Subject: [dba-Tech] Problems with dbReadOnly option

I've come across a problem that seems to be a bug.

With this code:

    Dim stg As String
    Dim rst As DAO.Recordset
    
    stg = "SELECT * FROM tblTest"
1)  Set rst = DBEngine(0)(0).OpenRecordset(stg, dbOpenDynaset, dbReadOnly)
2)  Set rst = DBEngine(0)(0).OpenRecordset(stg, dbOpenDynaset, , dbReadOnly)
3)  Set rst = DBEngine(0)(0).OpenRecordset(stg, dbOpenDynaset, dbReadOnly,
dbReadOnly)

Line 1 works, as the help file says it should.  But putting dbReadOnly into
this position is now obsoleted.

Line 2 does not work, but help says that this is now the correct way to do
it.

Line 3 does work, even though help explicitly says that this will cause an
error.

Anyone have similar experiences or know what is happening?

Thanks!
Dan



_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com




More information about the dba-Tech mailing list