Have now solved this myself - left here for anyone to read if they want.
Hi,
I'm having trouble working out the coding for this.
This is the process I want to achieve
1/ Open a form tied to a filter (done - filter resides in the Filter filed in the Form properties box)
2/ Click a command button that adjusts the value of a couple of text boxes bound to a record and then saves (updates) the record. Done
3/ The resulting record should no longer be passed by the filter so I need to refresh the form / filter somehow. This is where I get stuck. I guess I need something to go into the Form_AfterUpdate event but whatever I've tried so far hasnt worked.
Below code for what i have got so far for the Command button and update procedures.
Any help / ponters to other threads much appreciated
Solution: RunCommand acCmdApplyFilterSort placed in AfterUpdate event.
Tris
Hi,
I'm having trouble working out the coding for this.
This is the process I want to achieve
1/ Open a form tied to a filter (done - filter resides in the Filter filed in the Form properties box)
2/ Click a command button that adjusts the value of a couple of text boxes bound to a record and then saves (updates) the record. Done
3/ The resulting record should no longer be passed by the filter so I need to refresh the form / filter somehow. This is where I get stuck. I guess I need something to go into the Form_AfterUpdate event but whatever I've tried so far hasnt worked.
Below code for what i have got so far for the Command button and update procedures.
Code:
Option Explicit
Private Sub CmdButtonCloseAction_Click()
'Adjust record values to relect closing of the safety action
Me.TxtBoxPosRes.Value = 1
Me.TxtBoxClosDate = Now()
Me.CmbIDClos = "138"
'Save record changes - 'trigger before update' event
RunCommand acCmdSaveRecord
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ConfirmCheck As VbMsgBoxResult
'Ask user to confirm
ConfirmCheck = MsgBox("You are closing this action. Do you want to continue?", vbOKCancel, "Confirm Changes")
If ConfirmCheck = vbCancel Then 'Undo changes and cancel record update
Cancel = True
Me.Undo
Exit Sub
End If
MsgBox "Changes have been saved", vbOKOnly
End Sub
Private Sub Form_AfterUpdate()
End Sub
Any help / ponters to other threads much appreciated
Solution: RunCommand acCmdApplyFilterSort placed in AfterUpdate event.
Tris
Last edited: