Donkeygirl
Technical User
I have this code, and it is used on click of a form to make a table with all capital letters, become proper case. This means that BOB SMITH, with BOB in a first name field, and SMITH in the last name field, becomes Bob and Smith. This is really helpful for some of the data that comes through our office.
Right now, I am trying to take the procedure and make it so that it will ask the user what table they want to format, and what fields in the table they want to format. This would make the procedure easy for anyone in the office run, and it would make it run faster for me. I am wondering if anyone can help me expand this code to do that.
Thank you in advance
Option Compare Database
Function ghFixCase()
On Error GoTo Err1
Dim SQL As String, Rs As Recordset, Db As Database
Set Db = CurrentDb()
SQL = "SELECT [MCDC Weighted Count].* FROM [MCDC Weighted Count]"
Set Rs = Db.OpenRecordset(SQL, dbOpenDynaset)
Do Until Rs.EOF
Rs.Edit
Rs![City/towns] = StrConv(Rs![City/towns], vbProperCase)
Rs![LAST NAME] = StrConv(Rs![LAST NAME], vbProperCase)
Rs![FIRST NAME] = StrConv(Rs![FIRST NAME], vbProperCase)
Rs![STREET] = StrConv(Rs![STREET], vbProperCase)
Rs![POSTAL ZONE] = StrConv(Rs![POSTAL ZONE], vbProperCase)
Rs.Update
Rs.MoveNext
Loop
Rs.Close
Db.Close
MsgBox "Done! ", vbInformation, "Proper case!"
Exit1:
Exit Function
Err1:
MsgBox Err.Number & " " & Err.Description, vbInformation, "Proper case error..."
Resume Exit1
End Function
I hope someone can help
Donkeygirl,
Kickin' the crap out of Access
Right now, I am trying to take the procedure and make it so that it will ask the user what table they want to format, and what fields in the table they want to format. This would make the procedure easy for anyone in the office run, and it would make it run faster for me. I am wondering if anyone can help me expand this code to do that.
Thank you in advance
Option Compare Database
Function ghFixCase()
On Error GoTo Err1
Dim SQL As String, Rs As Recordset, Db As Database
Set Db = CurrentDb()
SQL = "SELECT [MCDC Weighted Count].* FROM [MCDC Weighted Count]"
Set Rs = Db.OpenRecordset(SQL, dbOpenDynaset)
Do Until Rs.EOF
Rs.Edit
Rs![City/towns] = StrConv(Rs![City/towns], vbProperCase)
Rs![LAST NAME] = StrConv(Rs![LAST NAME], vbProperCase)
Rs![FIRST NAME] = StrConv(Rs![FIRST NAME], vbProperCase)
Rs![STREET] = StrConv(Rs![STREET], vbProperCase)
Rs![POSTAL ZONE] = StrConv(Rs![POSTAL ZONE], vbProperCase)
Rs.Update
Rs.MoveNext
Loop
Rs.Close
Db.Close
MsgBox "Done! ", vbInformation, "Proper case!"
Exit1:
Exit Function
Err1:
MsgBox Err.Number & " " & Err.Description, vbInformation, "Proper case error..."
Resume Exit1
End Function
I hope someone can help
Kickin' the crap out of Access