NauticalGent
Ignore List Poster Boy
- Local time
- Today, 07:20
- Joined
- Apr 27, 2015
- Messages
- 6,319
Found this on a FB page today:
I started to engage on the "Best Practice" bit, but then thought better of it.
Microsoft Access Embedded Macro Vs Event Procedure
The best practice:
For the development of the user interface in Microsoft Access, we should use the built-in Macros/embedded Macros as many as possible. They run faster and also we can create Action Macros very fast instead of hand-coding.
.
Limitations:
There are a few limitations though. When we click the built-in Macro for navigation to the next record, it goes to the New if it is the last record. For this command, I always use "Event Procedure" like below. It will not go to New and if it is the last record and also, it will popup message for the user.
.
Private Sub CmdNext_Click()
If Me.CurrentRecord < Me.Recordset.RecordCount Then
DoCmd.GoToRecord Record:=acNext
ElseIf Me.CurrentRecord = Me.Recordset.RecordCount Then
MsgBox "This is the last record.", vbInformation + vbOKOnly, "Last"
End If
End Sub
.
If you are using this condition in an embedded Macro, then please let me know. It will help me.
I started to engage on the "Best Practice" bit, but then thought better of it.