J
john.bartlett
I am having some issues with selecting the TOP value in an UPDATE
query. I am not an expert and I am looking for advice on the best way
to proceed.
Here is a UPDATE query I am using that works. It updates the
PrizeAssigned field to "1" in the Main Table where Weight1 is equal to
200.
dbs.Execute "UPDATE Main " & _
"SET PrizeAssigned = 1 " & _
"WHERE tblMain.[Weight1] = 200;"
The problem I have is that I don't want to have to specify the value
for Weight1. I want Access to select the Weight1 record with the
greatest value. This is how I think it should be but I can't figure
out the syntax to replace "SELECT TOP 1" in this statement?
dbs.Execute "UPDATE tblMain " & _
"SET PrizeAssigned = 1 " & _
"WHERE tblMain.[Weight1] = SELECT TOP 1;"
Any advice/guidance is appricated.
Thanks,
JB
query. I am not an expert and I am looking for advice on the best way
to proceed.
Here is a UPDATE query I am using that works. It updates the
PrizeAssigned field to "1" in the Main Table where Weight1 is equal to
200.
dbs.Execute "UPDATE Main " & _
"SET PrizeAssigned = 1 " & _
"WHERE tblMain.[Weight1] = 200;"
The problem I have is that I don't want to have to specify the value
for Weight1. I want Access to select the Weight1 record with the
greatest value. This is how I think it should be but I can't figure
out the syntax to replace "SELECT TOP 1" in this statement?
dbs.Execute "UPDATE tblMain " & _
"SET PrizeAssigned = 1 " & _
"WHERE tblMain.[Weight1] = SELECT TOP 1;"
Any advice/guidance is appricated.
Thanks,
JB