Hello. I frequently find myself needing to retrieve a value from a table that I will use as part of a SQL statement that I am building in code. For example, I might need to pull the max date from a certain field then use that in a Where clause to pull all records with that date.
In Oracle PL/SQL, I could use "SELECT MAX(RUNDATE) INTO Variable_Name" then use "Variable_Name" later in my code. I have not discovered a similar function in Access VBA. I'm sure this is easy but I haven't figured out a solution. I usually end up with a Make-Table query that I join to in order to accomplish this.
Also, I know that this example isn't the best because it could be handled in a single SQL statement. I seem to frequently need to be able to put a single result of a query into a variable though.
Thank you for any thoughts on this.
Troy
In Oracle PL/SQL, I could use "SELECT MAX(RUNDATE) INTO Variable_Name" then use "Variable_Name" later in my code. I have not discovered a similar function in Access VBA. I'm sure this is easy but I haven't figured out a solution. I usually end up with a Make-Table query that I join to in order to accomplish this.
Also, I know that this example isn't the best because it could be handled in a single SQL statement. I seem to frequently need to be able to put a single result of a query into a variable though.
Thank you for any thoughts on this.
Troy