Hi,
I'm using Queries to get the datarecords that I want to use in my VBA code.
For this query to display only up-to-date data, I always use "DoCmd.OpenQuery" followed with the datagathering/editing that needs to be done, and ending with "DoCmd.Close"
Now my question: is it really necessary to open the query each time to be able to use it's data (and to be 100% sure that it does not contain an old recordset that might need to be refreshed first)?
I prefer it when the user doesn't to see this Query open and close when he triggers the sub to execute.
As an example some bits and pieces of my login script:
Code:
Set db = CurrentDb
Password = InputBox("Login Password?")
DoCmd.OpenQuery ("QLogin")
Set rs2 = db.OpenRecordset("QLogin")
If Password = rs2.Fields("UPW") Then
'...
DoCmd.Close