|
- Public Sub UCaseAllRecord()
- Dim strTblName() As String
- Dim rs As New ADODB.Recordset
- Dim i As Long, j As Long
- Dim k As Integer
- Dim db As Database
- Dim tbl As DAO.TableDef
- Dim strName As String
- Set db = CurrentDb
- For Each tbl In db.TableDefs
- If Left(tbl.Name, 4) <> "msys" Then
- strName = strName & tbl.Name & ","
- End If
- Next
- strTblName = Split(strName, ",")
- For i = 0 To UBound(strTblName) - 1
- rs.Open strTblName(i), CurrentProject.Connection, adOpenKeyset, adLockOptimistic
- For j = 1 To rs.RecordCount
- For k = 0 To rs.Fields.Count - 1
- If Not IsNull(rs.Fields(k)) Then
- rs.Fields(k) = UCase(rs.Fields(k))
- End If
- Next
- rs.UpdateBatch
- rs.MoveNext
- Next
- rs.Close
- Next
- Set rs = Nothing
- End Sub
复制代码 |
|