CPGDeveloper
Board Regular
- Joined
- Oct 8, 2008
- Messages
- 185
Hi Everyone --
I administer an application -- MS Access FE/Azure SQL BE -- would love to get people's opinions on best practices concerning Error Messages.
This application has, at the moment, has 120 different possible error messages, and I have put these error messages in a back end table, and written a public subroutine to access the proper message in code. Something like this:
So in my application, when there is an instance to pop-up an error message, instead of
MsgBox "This is your error"
I use the subroutine to find the stored error message
Call errormessage(25) '25 being the 'This is your error' message
The idea being that if the messages changes, I simply change it in the table, as opposed to having to change the code and put out a new version. Is this overkill? How is this usually done? Any thoughts would be appreciated. Thanks.
I administer an application -- MS Access FE/Azure SQL BE -- would love to get people's opinions on best practices concerning Error Messages.
This application has, at the moment, has 120 different possible error messages, and I have put these error messages in a back end table, and written a public subroutine to access the proper message in code. Something like this:
VBA Code:
Sub ErrorMessage(enum as Integer)
Dim emsg As String
Dim ers As New Adodb.recordset
Dim esql as String
esql = "SELECT message FROM temessage WHERE id = " & enum & ";"
ers.open currentproject.connection, esql
emsg = ers.Fields(0).value
ers.close
set ers = nothing
Msgbox emsg
End Sub
So in my application, when there is an instance to pop-up an error message, instead of
MsgBox "This is your error"
I use the subroutine to find the stored error message
Call errormessage(25) '25 being the 'This is your error' message
The idea being that if the messages changes, I simply change it in the table, as opposed to having to change the code and put out a new version. Is this overkill? How is this usually done? Any thoughts would be appreciated. Thanks.