Hi All,
I have a combo box "VendorID" on a subform, where after update I am trying to requery the parent form [frm Equipment Primary] and return back to the record which has just been updated. I have found the code below on the net,
Private Sub YourControl_AfterUpdate()
Dim recNum As Long
recNum = Me.CurrentRecord
Me.Requery
DoCmd.GoToRecord acDataForm, "YourForm", acGoTo, recNum
End Sub
Which I have modified to
Private Sub VendorID_AfterUpdate()
Dim recNum As Long
recNum = Forms![frm Equipment Primary].CurrentRecord
Forms![frm Equipment Primary].Requery
DoCmd.GoToRecord acDataForm, Forms![frm Equipment Primary], acGoTo, recNum
End Sub
but it throws the error "2498 wrong data type for one of the arguments". Any ideas?
I tried the immediate window to see the status of recNum, but it returned "variable not yet created in this context"?
Thanks and regards
Mark.
I have a combo box "VendorID" on a subform, where after update I am trying to requery the parent form [frm Equipment Primary] and return back to the record which has just been updated. I have found the code below on the net,
Private Sub YourControl_AfterUpdate()
Dim recNum As Long
recNum = Me.CurrentRecord
Me.Requery
DoCmd.GoToRecord acDataForm, "YourForm", acGoTo, recNum
End Sub
Which I have modified to
Private Sub VendorID_AfterUpdate()
Dim recNum As Long
recNum = Forms![frm Equipment Primary].CurrentRecord
Forms![frm Equipment Primary].Requery
DoCmd.GoToRecord acDataForm, Forms![frm Equipment Primary], acGoTo, recNum
End Sub
but it throws the error "2498 wrong data type for one of the arguments". Any ideas?
I tried the immediate window to see the status of recNum, but it returned "variable not yet created in this context"?
Thanks and regards
Mark.