I am trying to use a variable to define a field using DAO, for example:
Dim dbs As Database
Dim rst As DAO.Recordset
Dim Location as String, PartStr as String
Dim RecParts as Integer
Location = Combo1.Value
PartStr = Combo45.Value
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT [" & Location & "] FROM [dbo_Inv Master] where [Inventory Part] = '" & PartStr & "'"
With rst
.Edit
!["& Location &"] = RecParts <---HERES MY PROBLEM
.Update
End With
Within the "With" statment, I can't get it to reconize that the value of "Location" is a field.
Any thoughts?
Thanks Dodge
Dim dbs As Database
Dim rst As DAO.Recordset
Dim Location as String, PartStr as String
Dim RecParts as Integer
Location = Combo1.Value
PartStr = Combo45.Value
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT [" & Location & "] FROM [dbo_Inv Master] where [Inventory Part] = '" & PartStr & "'"
With rst
.Edit
!["& Location &"] = RecParts <---HERES MY PROBLEM
.Update
End With
Within the "With" statment, I can't get it to reconize that the value of "Location" is a field.
Any thoughts?
Thanks Dodge