Hi All,
I am playing around with some VBA code because I want to understand how it works and just make my MS Access Databases more "efficient".
I really don't understand how varibles and constants get transferred around, like for a multi user database. I have front ends and back ends but no understanding of VBA code.
I did this little code to set all the First names in a table to upper case, but nothing is happening to the table.
I don't get any errors when I run it in the immediate window.
could someone help me out?
Thanks!
Larry
I am playing around with some VBA code because I want to understand how it works and just make my MS Access Databases more "efficient".
I really don't understand how varibles and constants get transferred around, like for a multi user database. I have front ends and back ends but no understanding of VBA code.
I did this little code to set all the First names in a table to upper case, but nothing is happening to the table.
I don't get any errors when I run it in the immediate window.
could someone help me out?
Code:
Sub UpperCase()
Dim db As Database
Dim rst As Recordset
'set Database to current and recordset to pull just the firstname column
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT CopyOfContact.First" & _
" FROM CopyOfContact " & _
"WHERE (((CopyOfContact.First) Is Not Null))")
If Not rst.EOF And Not rst.BOF Then
For i = 0 To rst.Fields.Count - 1
rst.MoveFirst
Do Until rst.EOF
If rst(i).Name = rst("First") Then
rst.Edit
rst.Fields("First") = UCase("First")
rst.Update
End If
rst.MoveNext
Loop
Next i
End If
Set db = Nothing
Set rst = Nothing
'Do While Not rst.EOF
' UCase (rst![First])
'rst.MoveNext
'Loop
End Sub
Thanks!
Larry