When writing a query for SQL Server, you can declare and use variables like this:
declare @test int
select @test = max(ID) from MyTable1
update MyTable2 set (...) where ID > @test
update MyTable3 set (...) where ID < @test
Is there a way to declare and use variables similarly when writing a query for MS Access?
I need to populate the variable with the result of another query and then use that value to perform insert/update operations. The query will be run from a .NET app.
In a way
However, you cannot use
set @test = 1234, the parameter can be manually entered when the query is run or set in VBA.Joel Coehoorn
In Query MS Access database in VB 2008
Further Notes re Edit to OP
Query 1
Query 2