I have a problem that if I have a form open and a new record gets added by another user, I have to close my form before I can go to that record. My current setup is that I have a Home form that has a list of the active records and I have my Loan form that has all the details. When I select a record on my Home form, I use the following code to go to the selected record on my Loan form:
- DoCmd.OpenForm "frmLoans"
-
DoCmd.SearchForRecord , , acFirst, "LoanID = " & LoanID
This works even if I leave my Loan form open and then go to my Home form and select an already existing loan. However, if I select a loan that was added after the Loan form was opened, the record doesn't move. My thinking is that the new record wasn't part of the query when the form was opened and therefore it doesn't see that record. My idea is to just add
Forms!frmLoans.Requery between the above two lines so that the new record is available. However, I think that this will trigger the OnCurrent event to run twice; once for the requery and then again for the .SearchForRecord. Is there a better way to do this? I'm thinking something to do with the recordsource, but not sure what.
I hope I'm clear. It is a bit complicated to explain.