G
Guest
The below program works for everything except the update. I am trying to
make the program apply to various tables and fields.
Thanks for your help
Dim arg1 As Variant
Dim arg2 As Variant
arg2 = "test"
Dim dbb01 As DAO.Database
Dim rstb01 As DAO.Recordset
Set dbb01 = CurrentDb()
Set rstb01 = dbb01.OpenRecordset(arg2, dbOpenDynaset)
arg1 = [rstb01]![CUSTOMER_ID]
rstb01.MoveFirst
If (rstb01.EOF) Then GoTo bo1 Else
Dim var1 As Variant
Dim var2 As Variant
Dim counter As Integer
counter = 12
var1 = [arg1]
GoTo b02
b03:
rstb01.MoveNext
If (rstb01.EOF) Then GoTo bo1 Else
counter = 12
var1 = arg1
b02:
rstb01.Edit
counter = counter - 1
var2 = Left(var1, 1)
If var2 = 0 Then var1 = Right(arg1, counter) Else GoTo b03
arg1 = var1
rstb01.Update ' Does not
update the table
GoTo b02
bo1:
rstb01.Close
dbb01.Close
make the program apply to various tables and fields.
Thanks for your help
Dim arg1 As Variant
Dim arg2 As Variant
arg2 = "test"
Dim dbb01 As DAO.Database
Dim rstb01 As DAO.Recordset
Set dbb01 = CurrentDb()
Set rstb01 = dbb01.OpenRecordset(arg2, dbOpenDynaset)
arg1 = [rstb01]![CUSTOMER_ID]
rstb01.MoveFirst
If (rstb01.EOF) Then GoTo bo1 Else
Dim var1 As Variant
Dim var2 As Variant
Dim counter As Integer
counter = 12
var1 = [arg1]
GoTo b02
b03:
rstb01.MoveNext
If (rstb01.EOF) Then GoTo bo1 Else
counter = 12
var1 = arg1
b02:
rstb01.Edit
counter = counter - 1
var2 = Left(var1, 1)
If var2 = 0 Then var1 = Right(arg1, counter) Else GoTo b03
arg1 = var1
rstb01.Update ' Does not
update the table
GoTo b02
bo1:
rstb01.Close
dbb01.Close