grabbing an ID from one table using another field

swarv

Registered User.
Local time
Today, 18:26
Joined
Dec 2, 2008
Messages
196
Hi all,

Basically I an updating a table (called tbl_users) using this code:

Code:
updateuser = "UPDATE tbl_users SET hourspw =  '" & newhours & "'  WHERE (tbl_users.name = '" & personsname & "')" 'AND [Start_Date] > DateAdd("m", -12, Date()) AND [absentcode]='countme')"
CurrentDb.Execute updateuser

That works fine.

Now I want the program to look in another table (called basedata) and using the string 'personsname' (which is the same in both tables) get the number from the ID field in that table.

Is this possible?

Thanks

Martin
 
Hi,

updateuser = "UPDATE tbl_users, basedata SET tbl_users.hourspw = '" & newhours & "', tbl_users.ID = basedata.ID WHERE (tbl_users.name = '" & personsname & "')" 'AND [Start_Date] > DateAdd("m", -12, Date()) AND [absentcode]='countme') AND tbl_users.ID = basedata.ID"

CurrentDb.Execute updateuser

That should do it, if I understood the problem correctly

Simon B.
 

Users who are viewing this thread

Back
Top Bottom