Hi! I need help with the following:
Even though it is quite easy to run SQL UPDATE queries in VBA using the DoCmd.RunSQL, I cannot find a way to run SELECT queries and use the result.
I have a table with customer names and orders. I want to store the latest orderID of a particular customer in a local variable.
In short, I would like to run this:
Private orderid as integer
orderid = {the result from the query below}
{SELECT Top 1 Orders.OrderID FROM Orders WHERE Order.customer = "Mr x" ORDER BY Orders.OrderID DESC;}
Thanks!
Even though it is quite easy to run SQL UPDATE queries in VBA using the DoCmd.RunSQL, I cannot find a way to run SELECT queries and use the result.
I have a table with customer names and orders. I want to store the latest orderID of a particular customer in a local variable.
In short, I would like to run this:
Private orderid as integer
orderid = {the result from the query below}
{SELECT Top 1 Orders.OrderID FROM Orders WHERE Order.customer = "Mr x" ORDER BY Orders.OrderID DESC;}
Thanks!
Comment