P
Pwood57
I am developing a DB for volunteer organizations for users with little
or no experience with Access. I have a number of tables and forms
because the DB includes membership, attendance for a number of age
related groups, contributions, ledger, prospects, calendar, event
planning, etc.
To enhance user friendliness I have placed command buttons on most
forms that open other interrelated forms. So I have a lot of code. In
order to reduce the amount of code I created a public sub. I am not
very expereinced in VBA so I would like some input on whether my code
needs improvement.
This code is in the "Global Module":
Public Sub Openmyfrm(stDocName As String)
On Error GoTo Err_Openmyfrm
Dim stLinkCriteria As String
DoCmd.OpenForm stDocName, , , stLinkCriteria
stDocName = Empty
stLinkCriteria = Empty
Exit_Openmyfrm:
Exit Sub
Err_Openmyfrm:
MsgBox Err.Description
Resume Exit_Openmyfrm
End Sub
This is the code for the command buttons on the forms:
Private Sub btnOpenfrmSample_Click()
Openmyfrm "frmSample"
End Sub
Thanks in advance for your input.
Pat Wood
or no experience with Access. I have a number of tables and forms
because the DB includes membership, attendance for a number of age
related groups, contributions, ledger, prospects, calendar, event
planning, etc.
To enhance user friendliness I have placed command buttons on most
forms that open other interrelated forms. So I have a lot of code. In
order to reduce the amount of code I created a public sub. I am not
very expereinced in VBA so I would like some input on whether my code
needs improvement.
This code is in the "Global Module":
Public Sub Openmyfrm(stDocName As String)
On Error GoTo Err_Openmyfrm
Dim stLinkCriteria As String
DoCmd.OpenForm stDocName, , , stLinkCriteria
stDocName = Empty
stLinkCriteria = Empty
Exit_Openmyfrm:
Exit Sub
Err_Openmyfrm:
MsgBox Err.Description
Resume Exit_Openmyfrm
End Sub
This is the code for the command buttons on the forms:
Private Sub btnOpenfrmSample_Click()
Openmyfrm "frmSample"
End Sub
Thanks in advance for your input.
Pat Wood