Hi all,
I am trying to run an update query based on the top x records of a table. I have got the update function to work, but it updates all records as opposed to the top x.
Please see below code:
Any help would be greatly appreciated as it's driving me bonkers!!
Thanks
Ben
I am trying to run an update query based on the top x records of a table. I have got the update function to work, but it updates all records as opposed to the top x.
Please see below code:
Code:
Dim strSQL As String
strSQL = "UPDATE SectionStatus SET Position01=2 WHERE EXISTS "
strSQL = strSQL & "(SELECT TOP " & Me.C01 & " SectionDesign, Position01, SectionNumber FROM SectionStatus WHERE Position01 = 1 ORDER BY SectionNumber) "
CurrentDb.Execute strSQL, dbFailOnError
Any help would be greatly appreciated as it's driving me bonkers!!
Thanks
Ben