G
Guest
Hi There,
Is there any way to dynamically change a field name in the update code? I
have the following code: The String UpdStr contains the name of a field in my
table that I want to update. I keep getting the error that no such name
exists in the table.
Say the contents of UpdStr was "Aspiration" which is a fieldname in my
table. How do I code it to a field to be updated?
Public Sub WriteConfig()
Dim SizeVar As Variant
Dim UpdStr As String
SizeVar = Len(Me.TagName) - 3
UpdStr = Mid(Me.TagName, 1, SizeVar)
Dim dbAces As DAO.Database
Dim rst As DAO.Recordset
Dim NewDate As Field
Set dbAces = CurrentDb
Set rst = dbAces.OpenRecordset("AcesData")
rst.MoveLast
With rst
.Edit
![UpdStr] = Me.TagID
!ChangeDate = Now
.Update
.Close
End With
dbAces.Close
End Sub
Is there any way to dynamically change a field name in the update code? I
have the following code: The String UpdStr contains the name of a field in my
table that I want to update. I keep getting the error that no such name
exists in the table.
Say the contents of UpdStr was "Aspiration" which is a fieldname in my
table. How do I code it to a field to be updated?
Public Sub WriteConfig()
Dim SizeVar As Variant
Dim UpdStr As String
SizeVar = Len(Me.TagName) - 3
UpdStr = Mid(Me.TagName, 1, SizeVar)
Dim dbAces As DAO.Database
Dim rst As DAO.Recordset
Dim NewDate As Field
Set dbAces = CurrentDb
Set rst = dbAces.OpenRecordset("AcesData")
rst.MoveLast
With rst
.Edit
![UpdStr] = Me.TagID
!ChangeDate = Now
.Update
.Close
End With
dbAces.Close
End Sub