The routines in Listing 27.2 reflect their DAO counterparts with the names ap_SetDatabaseProp and ap_GetDatabaseProp.
Sub ap_SetDatabaseProp(strPropertyName As String, varValue As Variant) Dim rstDBProps As New ADODB.Recordset rstDBProps.Open "ztblDatabaseProperties", CurrentProject.Connection, _ adOpenDynamic, adLockOptimistic rstDBProps(strPropertyName) = varValue rstDBProps.Update rstDBProps.Close End Sub Function ap_GetDatabaseProp(strPropertyName As String) As Variant Dim rstDBProps As New ADODB.Recordset rstDBProps.Open "ztblDatabaseProperties", CurrentProject.Connection, _ adOpenStatic ap_GetDatabaseProp = rstDBProps(strPropertyName) rstDBProps.Close End Function |
Notice between these routines that when storing an updated value into the ztblDatabaseProperties table in ap_SetDatabaseProp, the recordset is opened dynamically, whereas in ap_GetDatabaseProp, the recordset is opened statically.
Next, the ap_AppInit routine performs the check to notify users whether they have to leave the application. Because this routine doesn't use ADO or DAO, it hasn't changed at all. For the sake of convenience and plug-and-play capability, the code and objects are included in the VideoApp(ADO).mdb; very detailed information on notifying users about logging them out of the system can be found in Chapter 26, in the section “Notifying and Logging Users Out of an Application.”
3.145.11.227