|  | Posted by Jim Carlock on 10/02/07 22:24 
"Steve" wrote...: i think he meant the DAO used in the 'with' statement...
 : which is NOT a namespace but an object instance. i believe
 : his code sample above would fail anyway since i don't recall
 : DAO being a static class - static was introduced to vb in
 : vb.net.
 
 You're right. I've got to use a user-defined type, object or
 Variant with the With statement.
 
 Private Function ConnectToDb(sFQFN As String) As DAO.Database
 Dim oDb As DAO.Database
 
 With oDb
 Set oDb = DAO.OpenDatabase(sDb)
 'Doesn't do much or show much here.
 'But if we were to include an oRs As DAO.Recordset we then
 'could use the following...
 '
 'Set oRs = .OpenRecordset(sSQL)
 '
 'And if so desired, we could return a DAO.Recordset.
 End With
 Set ConnectToDb = oDb
 End Function
 
 Good catch, Steve. I encoded it to confirm it.
 
 --
 Jim Carlock
 Swimming Pool, Spa And Water Feature Builders
 http://www.aquaticcreationsnc.com/
  Navigation: [Reply to this message] |