M
Mark Andrews
I borrowed some code from a Microsoft template basically to have a combobox
at the top of the form so if the user want to jump to a different record
they can by selecting a combobox choice. The following code is used:
Private Sub cboGoToPledge_AfterUpdate()
Dim strPledgeID As String
If (IsNull(Me.cboGoToPledge)) Then
Exit Sub
End If
On Error Resume Next
If (Me.Form.Dirty) Then
DoCmd.RunCommand acCmdSaveRecord
End If
strPledgeID = CStr(Me.cboGoToPledge)
If (Me.Form.FilterOn) Then
DoCmd.RunCommand acCmdRemoveFilterSort
End If
DoCmd.SearchForRecord , "", acFirst, "[PledgeID]=" & strPledgeID
End Sub
It works fine when the form is opened normally to an existing record.
However if I open the form as:
DoCmd.OpenForm "frmPledge",,,,acFormAdd, acDialog
the code to jump to a different record does not work.
Anyone know how I could tweak it to make it work?
Mark
at the top of the form so if the user want to jump to a different record
they can by selecting a combobox choice. The following code is used:
Private Sub cboGoToPledge_AfterUpdate()
Dim strPledgeID As String
If (IsNull(Me.cboGoToPledge)) Then
Exit Sub
End If
On Error Resume Next
If (Me.Form.Dirty) Then
DoCmd.RunCommand acCmdSaveRecord
End If
strPledgeID = CStr(Me.cboGoToPledge)
If (Me.Form.FilterOn) Then
DoCmd.RunCommand acCmdRemoveFilterSort
End If
DoCmd.SearchForRecord , "", acFirst, "[PledgeID]=" & strPledgeID
End Sub
It works fine when the form is opened normally to an existing record.
However if I open the form as:
DoCmd.OpenForm "frmPledge",,,,acFormAdd, acDialog
the code to jump to a different record does not work.
Anyone know how I could tweak it to make it work?
Mark