Summary:
-I have an ODBC Connection to a People table. This table is in our CRM system and the connection is read-only.
-I have a set of queries against this People table ending in a final UNION query called q_People that pulls the Persons_ID, Name, Department and Office.
-My local table contains the Person_ID field
-I can't include the UNION query in my form's Record Source as this makes the record not updateable.
-I want to display the persons Department and Office on my form, based on the Person_ID
I have 2 Unbound fields on my form named Department and Office
I have the following Form_Current event:
Expand|Select|Wrap|Line Numbers
- Private Sub Form_Current()
- Dim MyDatabase As DAO.Database
- Dim rstPeople As DAO.Recordset
- Set MyDatabase = CurrentDb
- Set rstPeople = MyDatabase.OpenRecordset("SELECT q_People.Department, q_People.Office FROM q_People WHERE People_ID = " & [People_ID])
- Me.Department = rstPeople!Department
- Me.Office = rstPeople!Office
- rstPeople.Close
- Set rstPeople = Nothing
- End Sub
QUESTION:
Would the data on the form update faster if I generate the record set just once when the form is opened? I would then use similar code as above to refer to an existing recordset and avoid having to generate the recordset each time the user views a new record.
I have tried to do this a couple of ways but am not able to get it to work.
Many thanks,
Sandra