B
Brad
Thanks for taking the time to read my question.
I have 5 fields named UpdatedTo with a number at the end
i.e. UpdatedTo1, UpdatedTo2, UpdatedTo3, UpdatedTo4, UpdatedTo5.
in my With statement, how can I iterate through these names with a variable?
i.e !UpdatedTo & x
This is what I have in my code but it doesn't work.
I want to do the same thing here as I am doing with the Controls() function.
Thanks so much for your help.
Brad
==================================================
Code:
Do Until x = 6
If Not IsNull(Me.Controls("SplitANumber" & x)) And
Me.Controls("SplitANumber" & x) <> 0 Then
With rst
.AddNew ' Add new record.
!FirstName = Me.SplitFirstName ' Add data.
!LastName = Me.SplitLastName ' Add data.
!PhoneNumber = Me.SplitPhoneNumber ' Add data.
!Gender = Me.SplitGender ' Add data.
!ANumber = Me.Controls("SplitANumber" & x) '
Add data.
'Line With Problem
!UpdatedTo & x = a + x ' Add data.
.Update ' Save changes.
End With
x = x + 1
Else
x = x + 1
End If
Loop
==================================================
I have 5 fields named UpdatedTo with a number at the end
i.e. UpdatedTo1, UpdatedTo2, UpdatedTo3, UpdatedTo4, UpdatedTo5.
in my With statement, how can I iterate through these names with a variable?
i.e !UpdatedTo & x
This is what I have in my code but it doesn't work.
I want to do the same thing here as I am doing with the Controls() function.
Thanks so much for your help.
Brad
==================================================
Code:
Do Until x = 6
If Not IsNull(Me.Controls("SplitANumber" & x)) And
Me.Controls("SplitANumber" & x) <> 0 Then
With rst
.AddNew ' Add new record.
!FirstName = Me.SplitFirstName ' Add data.
!LastName = Me.SplitLastName ' Add data.
!PhoneNumber = Me.SplitPhoneNumber ' Add data.
!Gender = Me.SplitGender ' Add data.
!ANumber = Me.Controls("SplitANumber" & x) '
Add data.
'Line With Problem
!UpdatedTo & x = a + x ' Add data.
.Update ' Save changes.
End With
x = x + 1
Else
x = x + 1
End If
Loop
==================================================