Hi All,
The code below is behind a combo box on a sub form.
I need this to change some formatting on parent form when certain changes are made to records in the subform to alert the user. The code for the formatting changes is in current event of the main form, so the code below is used to get the main form current event to run, but stay at the same parent record. Otherwise requery goes back to first record in the main form.
I have tried to get the formatting changes to work from the subfrm combo after update, but nothing happens? The requery is probably overkill, but is the closest thing I have found to reaching the solution.
It all works fine, however the focus remains on the parent form. What I would like is to return focus to the subform and to the record which was updated.
I have tried combining this with various different GoToRecord code I have found on the net, but with no success. The subform I am trying to return focus to is called [frm Vendors Primary].
Any ideas?
Many thanks.
Private Sub VendorID_AfterUpdate()
Dim frmMain As Form, sfrm As Form, hldMainID As Long
Set frmMain = Forms![frm Equipment Primary]
hldMainID = frmMain![EquipmentID]
frmMain.Requery
frmMain.Recordset.FindFirst "[EquipmentID] = " & hldMainID
Set frmMain = Nothing
The code below is behind a combo box on a sub form.
I need this to change some formatting on parent form when certain changes are made to records in the subform to alert the user. The code for the formatting changes is in current event of the main form, so the code below is used to get the main form current event to run, but stay at the same parent record. Otherwise requery goes back to first record in the main form.
I have tried to get the formatting changes to work from the subfrm combo after update, but nothing happens? The requery is probably overkill, but is the closest thing I have found to reaching the solution.
It all works fine, however the focus remains on the parent form. What I would like is to return focus to the subform and to the record which was updated.
I have tried combining this with various different GoToRecord code I have found on the net, but with no success. The subform I am trying to return focus to is called [frm Vendors Primary].
Any ideas?
Many thanks.
Private Sub VendorID_AfterUpdate()
Dim frmMain As Form, sfrm As Form, hldMainID As Long
Set frmMain = Forms![frm Equipment Primary]
hldMainID = frmMain![EquipmentID]
frmMain.Requery
frmMain.Recordset.FindFirst "[EquipmentID] = " & hldMainID
Set frmMain = Nothing