Hello bmcilwraith,
An update query, in my opinion, will not be able to achieve what you intend. Here is a VBA procedure that does exactly what you require :
'-----
Sub ReplZeros()
' Code By SanganakSakha 8/11/01
' No error checking or data validation
'
' Replaces zeros with previous digit
' eg 100200300 becomes 111222333
'
Dim rs1 As DAO.Recordset
Dim x, y, i, z, nx, w
Set rs1 = CurrentDb.OpenRecordset("")
rs1.MoveFirst
While rs1.EOF = False
x = Trim(rs1.Fields(""))
y = Left(x, 1)
' leftmost digit
z = Len(x)
nx = y
' New string being created
For i = 2 To z
w = Mid(x, i, 1)
If w = "0" Then
nx = nx & y
Else
y = w
nx = nx & w
End If
Next
rs1.Edit
rs1.Fields("TheFieldName") =nx
rs1.Update
rs1.MoveNext
Wend
End Sub
' -----
Paste this code in a module in the database and run it. You will have to substitute appropriate table and field name before doing so.
(You also need to make a reference to DAO in VBA IDE)
Iwould be glad to provide any further assistance you may need in this regard.
SanganakSakha,
Simple And Effective Solutions To Small Problems, No QuickFixes.