Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record Sets - DAO 1

Status
Not open for further replies.

leckie

Programmer
Apr 19, 2001
65
GB
Dim db As Database
Dim set1 As DAO.Recordset
Set db = CurrentDb()

Set set1 = db.OpenRecordset("archives", dbOpenDynaset)

set1.FindFirst "[factory_ref]='" & [factory_ref] & "'"
set1.Edit
set1.[lock_ref] = Me![partcode]
set1.Update
set1.Close

the above works fine as written but what I would like to do is replace [lock_ref] with a value stored in a variable for example

dim s as string

s = me![lock_ref]

set1.s = Me![partcode]

thank you in anticipation

gezro
 
Hi!

You can use a variable like this:

dim s as string

s = "lock_ref"

set1.Fields(s) = Me![partcode]

hth
Jeff Bridgham
bridgham@purdue.edu
 
that worked a treat, had been tearing my hair out with that one . .

top marks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top