Public Function basGetString(KeyName As String, ColumnName As String) As String
On Error GoTo basGetString_Err
Set m_rsADO = New ADODB.Recordset
m_rsADO.Open Source:="tblStrings", _
ActiveConnection:=m_cnnADO, _
CursorType:=adOpenKeyset, _
LockType:=adLockReadOnly, _
Options:=adCmdTable
With m_rsADO
.Find Criteria:="name = '" & KeyName & "'", _
SearchDirection:=adSearchForward
If Not .EOF Then _
basGetString = .Fields(ColumnName) & Empty
End With
basGetString_Exit: m_rsADO.Close Set m_rsADO = Nothing Exit Function
basGetString_Err: Select Case Err Case Else MsgBox Err & ": " & Err.Description, vbCritical, "basGetString Error" Resume basGetString_Exit End Select
End Function
Public Sub basWriteString(KeyName As String, NewStr As String)
Dim strSQL As String
On Error GoTo basWriteString_Err
strSQL = "UPDATE tblStrings SET tblStrings.string = """ & NewStr & """" _
& " WHERE tblStrings.name = """ & KeyName & """"
Set m_cmdADO = New ADODB.Command
With m_cmdADO
.ActiveConnection = m_cnnADO
.CommandType = adCmdText
.CommandText = strSQL
.Execute
End With
basWriteString_Exit: Set m_cmdADO = Nothing Exit Sub
basWriteString_Err: Select Case Err Case Else MsgBox Err & ": " & Err.Description, vbCritical, "basWriteString Error" Resume basWriteString_Exit End Select
End Sub