I have not tried this yet, because I need to take the database offline to do it...but here is what I have put together:
Set conn = New adodb.Connection
conn.Open "DSN=ERP;" & "TRUSTED_CONNECTION=YES"
statement = "SELECT DB_ItemID, DB_ItemName, DB_UnitMeasure, DB_Classification, DB_ItemTypeCode, DB_ProdFam, DB_ProdModel FROM DBASE ORDER BY DB_ItemID"
Set rs = conn.Execute(statement, , adCmdText)
row = 0
col = 7
ReDim aERP(15000, 7)
ItemID = 0
ItemName = 1
UnitMeasure = 2
Classification = 3
ItemTypeCode = 4
ProdFam = 5
ProdModel = 6
Do While Not rs.EOF
For i = 0 To col - 1
If rs.Fields(i).Value <> vbNullString Then
aERP(row, i) = StrConv(rs.Fields(i).Value, vbUpperCase)
End If
Next i
rs.Edit
rs!DB_ItemID = aERP(row, ItemID)
rs!DB_ItemName = aERP(row, ItemName)
rs!DB_UnitMeasure = aERP(row, ItemUnitMeasure)
rs!DB_Classification = aERP(row, Classification)
rs!DB_ItemTypeCode = aERP(row, ItemTypeCode)
rs!DB_ProdFam = aERP(row, ProdFam)
rs!DB_ProdModel = aERP(row, ProdModel)
rs.Update
row = row + 1
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
Of course this is only changing the case of those fields that have been entered incorrectly over the years, and (hopefully) not changing anything else.
Any suggestions? Comments?
Thanks for your help,
Alex
Set conn = New adodb.Connection
conn.Open "DSN=ERP;" & "TRUSTED_CONNECTION=YES"
statement = "SELECT DB_ItemID, DB_ItemName, DB_UnitMeasure, DB_Classification, DB_ItemTypeCode, DB_ProdFam, DB_ProdModel FROM DBASE ORDER BY DB_ItemID"
Set rs = conn.Execute(statement, , adCmdText)
row = 0
col = 7
ReDim aERP(15000, 7)
ItemID = 0
ItemName = 1
UnitMeasure = 2
Classification = 3
ItemTypeCode = 4
ProdFam = 5
ProdModel = 6
Do While Not rs.EOF
For i = 0 To col - 1
If rs.Fields(i).Value <> vbNullString Then
aERP(row, i) = StrConv(rs.Fields(i).Value, vbUpperCase)
End If
Next i
rs.Edit
rs!DB_ItemID = aERP(row, ItemID)
rs!DB_ItemName = aERP(row, ItemName)
rs!DB_UnitMeasure = aERP(row, ItemUnitMeasure)
rs!DB_Classification = aERP(row, Classification)
rs!DB_ItemTypeCode = aERP(row, ItemTypeCode)
rs!DB_ProdFam = aERP(row, ProdFam)
rs!DB_ProdModel = aERP(row, ProdModel)
rs.Update
row = row + 1
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
Of course this is only changing the case of those fields that have been entered incorrectly over the years, and (hopefully) not changing anything else.
Any suggestions? Comments?
Thanks for your help,
Alex