R
Rod
Hello,
I have had huge help on the following code. I would like to see what record
the computer is "working" on as the it makes its way through the tables,
~70,000 records. I saw it once where the status line displayed information
that would tell the user the record it was operating on, thus eleviate fears
that the coputer has locked up. How could this code be modified to show this
on the status line?
Sub FixPrefix()
'this code requires a reference set to the MS DAO object library
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strPrefix As String
Dim strNumber As String
Dim strData As String
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT RecOrder, DNCData, Number " & "FROM
tblDNCRawData ORDER BY RecOrder")
With rs
.MoveFirst
Do Until .EOF
strData = .Fields("DNCData")
'If Len(strData) = 10 Then
If Len(strData) = 14 Then
strPrefix = Mid(strData, 2, 3)
'strNumber = strData
strNumber = strPrefix & Mid(strData, 7, 3) & Mid(strData,
11, 4)
Else
'strNumber = strPrefix & strData
strNumber = strPrefix & Left(strData, 3) & Mid(strData, 5, 4)
End If
.Edit
.Fields("Number") = strNumber
.Update
.MoveNext
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub
Thanks much!
I have had huge help on the following code. I would like to see what record
the computer is "working" on as the it makes its way through the tables,
~70,000 records. I saw it once where the status line displayed information
that would tell the user the record it was operating on, thus eleviate fears
that the coputer has locked up. How could this code be modified to show this
on the status line?
Sub FixPrefix()
'this code requires a reference set to the MS DAO object library
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strPrefix As String
Dim strNumber As String
Dim strData As String
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT RecOrder, DNCData, Number " & "FROM
tblDNCRawData ORDER BY RecOrder")
With rs
.MoveFirst
Do Until .EOF
strData = .Fields("DNCData")
'If Len(strData) = 10 Then
If Len(strData) = 14 Then
strPrefix = Mid(strData, 2, 3)
'strNumber = strData
strNumber = strPrefix & Mid(strData, 7, 3) & Mid(strData,
11, 4)
Else
'strNumber = strPrefix & strData
strNumber = strPrefix & Left(strData, 3) & Mid(strData, 5, 4)
End If
.Edit
.Fields("Number") = strNumber
.Update
.MoveNext
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub
Thanks much!