Option Compare Database
Option Explicit
Function sam0801()
Randomize
DoCmd.RunSQL ("update tmp set tmpstr=tmpstr+'" & Chr(Int(Rnd * 26 + 65)) & "'")
End Function
Function sam0802()
If Len(DFirst("tmpstr", "tmp")) Mod 2 > 0 Then
DoCmd.RunSQL ("update tmp set tmpstr=left(tmpstr,len(tmpstr)-1)")
Else
DoCmd.RunSQL ("update tmp set tmpstr=right(tmpstr,len(tmpstr)-1)")
End If
End Function
Function sam0803()
Dim dbs As Database
Dim rst As Recordset
Dim strSQL As String
Dim i As Integer
Set dbs = CurrentDb()
strSQL = "SELECT * FROM [tmp];"
Set rst = dbs.OpenRecordset(strSQL)
rst.MoveFirst
While Not rst.EOF
rst.Edit
rst!tmpstr = rst!tmpstr & "x"
rst.Update
rst.MoveNext
Wend
rst.Close
dbs.Close
End Function
|