Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2006

Tip: Looking for answers? Try searching our database.

Error Handling - Call another Function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jackson - 28 Sep 2006 11:55 GMT
Hi,

I have a module called SendTrades which first checks conditions to send an
email, if the conditions are satified, it calls another module, EmailTrades
which will then put together an email and send it off.

It then goes back to the SendTrades function which then launches an update
query which updates which records have been sent via email.

If my mailbox in Outlook is full, currently the email doesn't get sent but
since the error is in the called function the original SendTrades continues
and updates the records as sent. What I want to do is when EmailTrades faces
any sort of error emailing, it then passes back to SendTrades but at the
Error Handler line - is this possible?

Thanks.
Barry Gilbert - 28 Sep 2006 19:42 GMT
You can return a boolean from the EmailTrades function to indicate whther it
was successful. For example:

Private Sub SendTrades()
 On Error GoTo Err_Handler
'do some stuff
If EmailTrades(parameters) Then
  'Do more stuff....
Else
   MsgBox "Problem with the email"
End If

Err_Resume:
   Exit Sub
Err_Handler:
   MsgBox Err.Description
   Resume Err_Resume
End Sub

Public Function EmailTrades(ByVal parameters as blah) As Boolean
   On Error GoTo Err_Handler
'do some emailing stuff. If it fails here, the function will return false.
   EmailTrades = True

Err_Resume:
   Exit Function
Err_Handler:
   Resume Err_Resume
End Function

Barry

> Hi,
>
[quoted text clipped - 12 lines]
>
> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.