Stuart McLachlan
stuart at lexacorp.com.pg
Sun May 26 21:22:44 CDT 2013
Looks to me like a braiin-dead automated Macro to VBA conversion process that doesn't deal with error trapping properly. To answer your first question - it serves no purpose. On 26 May 2013 at 22:00, William Benson (VBACreations. wrote: > I converted a command button which Access innately creates with an embedded > macro, to VBA code. This was the code that was produced, and my question is, > to what purpose is the MacroError (Application level) property at this > point... in VBA code it appears to have no relevance, whereas the Err object > itself does. > > For example, when trying to go to the next record when there is no next > record, if this were left as a macro button, I would get the error message > "You can't go to the specified record." But once I have converted the code > to VBA (See below) MacroError has a value of zero, but Err.Number has a a > value of 2105, which is the proper error. > > Anyone see any practical side to Access bothering to put code related to > MacroError instead of focusing on the err object directly? > > > Private Sub cmdNextCompany_Click() > On Error GoTo cmdNextCompany_Click_Err > > On Error Resume Next > DoCmd.GoToRecord , "", acNext > If (MacroError <> 0) Then > Beep > MsgBox MacroError.Description, vbOKOnly, "" > End If > > > cmdNextCompany_Click_Exit: > Exit Sub > > cmdNextCompany_Click_Err: > MsgBox Error$ > Resume cmdNextCompany_Click_Exit > > End Sub > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >