Hi,
I'm trying to make the code a bit better.
Do While (exit condition that works)
ProgNo = rst![ProgramNo] 'from another table, this changes on each iteration thru the loop
'inefficient!!!!! there should be a method to requery without opening and closing each time
rst2.Open "SELECT ProgramName FROM tblProgName WHERE ProgramNo =" & ProgNo, CurrentProject.Connection, adOpenDynamic, adLockOptimistic, adCmdText
ProgName = rst2!ProgramName
rst2.Close
Loop
Obviously, it is ridiculus to open and close the table each time, I was wondering if anyone knew the function I should be using. Note that the query is based on the ProgNo variable that changes on each iteration.
Thanks in advance,
Eric
I'm trying to make the code a bit better.
Do While (exit condition that works)
ProgNo = rst![ProgramNo] 'from another table, this changes on each iteration thru the loop
'inefficient!!!!! there should be a method to requery without opening and closing each time
rst2.Open "SELECT ProgramName FROM tblProgName WHERE ProgramNo =" & ProgNo, CurrentProject.Connection, adOpenDynamic, adLockOptimistic, adCmdText
ProgName = rst2!ProgramName
rst2.Close
Loop
Obviously, it is ridiculus to open and close the table each time, I was wondering if anyone knew the function I should be using. Note that the query is based on the ProgNo variable that changes on each iteration.
Thanks in advance,
Eric