Use events to pass back information to the calling application:
(Using you code form below)
Code:
'In the declarations section
Public Event UpdateSuccessful()
Public Event UpdateError(plngErrorNumber as Long, pstrErrDesc as String)
'In the
if objsales.addnew then
' add new items
if objsales.update then
RaiseEvent UpdateSuccessful
else
RaiseEvent UpdateError(Err.Number, Err.Description
end if
Then, when you declare that object in the application, you declare it using the WithEvents keyword, remembering that it must be a module level declaration eg:
Code:
Private WithEvents mobjSales as clsSales
Alternatively, you can use Err.Raise to pass the error out (but this way you MUST catch the error. Using Withevents means the error is caught in the DLL, not the app.
- gaffa