visual basic coding send
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Visual Basic Coding to send an reminder when approaching an Expe

Visual Basic Coding to send an reminder when approaching an Expe

resolvedResolved · Urgent Priority · Version 2003

replyReply Mon 16 Aug 2010, 16:35Delegate Manjeet said...

Manjeet has attended:
Access VBA course

Visual Basic Coding to send an reminder when approaching an Expe

Hi,

I am trying to send a reminder email when approaching a particular date.

The email coding is working, however when the number of records that are approaching the Expected Completion Date are to be displayed an error message is being displayed
'Wrong number of arguments or invalid property assignment.

I have copied and pasted the coding and the above error message displays highlighting the DCount wording.

Private Sub Form_Close()

Dim intStore As Integer, lngNoDays As Long, strLogClosed As String

Dim LValue As Integer
'intStore = DCount("[ITLLogNumber]", "[tblItlrequestlog]", "[txtLoggedclosed] =Yes")
intStore = DCount("[Log Number]", "[tblItlrequestlog]", "[txtLoggedclosed]", _
"[txtECDDate] <=Now() AND [Complete] =Yes")
If intStore = 0 Then

If MsgBox("There are " & intStore & "emails to be sent" & _
vbCrLf & vbCrLf & "Would you like to send them now?", _
vbYesNo, "You have outstanding emails to be sent...") = vbYes Then
' send an email
Dim AnyData As String, Var
Dim dbData As DAO.Database
Dim rstLogFile As DAO.Recordset
Dim stWhere As String '--criteria for DLookup
Dim varTo As Variant '--Address for SendObject
Dim stText As String '--E-mail text
Dim RecDate As Variant '--Rec date for e-mail text
Dim stSubject As String '--The ITL log no from form
Dim stHelpDesk As String '--Create SQL update statement
Dim errLoop As Error

'Set dbData = CurrentDb
'Set rstLogFile = dbData.OpenRecordset("ITLRequestLog1", dbOpenTable)
'rstLogFile.MoveFirst
'rstLogFile.MoveLast
'Var = rstLogFile![ITLLogNumber]

'rstLogFile.Close
'dbData.Close

'insert email information here
'--Combo of names to assign ticket to
'stWho = Me!["ITL Request Log1"]
'stWhere = ("ITLRequestLog1") = " & " '" & stWho & "'"
'-- Email address from
stWho = Me![txtLoggedby] '"manjeet.marwaha@equitygroup.co.uk"

'string of details being pulled in from table

stSubject = "::ITL Request Log Closure Email - Log No::" & Me.[txtITLLogNumber]
stLoggedby = Me.txtLoggedby
stTel_Ext = Me.txtTelext
stUnderwritingref = Me.txtUnderref
stScheme = Me.txtErscheme
stSchemeBuildType = Me.cboSchemebuild
stDepartment = Me.cboDepart
stSoftwarehouse = Me.cboSoftwarehouse
stProduct = Me.cboProducttype
stFulldesofproblem = Me.txtFulldescriptionproblem
stAllocatedto = Me.cboAllocatedto
stCatergory_typeofsubmission = Me.cboCategory
stPriority = Me.cboPriority
stecddate = Me.txtECDDate
stFinalcomments = Me.txtFinalcomments
stLogclosed = Me.txtLoggedclosed
stLogclosuredate = Me.txtDateclosureemailsent

'Information that will be sent in the Email
stText = "ITL Request Log Closure Email." & Chr$(13) & _
Chr$(13) & "Logged By: " & stLoggedby & Chr$(13) & _
Chr$(13) & "Tel/Ext: " & stTel_Ext & Chr$(13) & _
Chr$(13) & "Underwriting Ref: " & stUnderwritingref & Chr$(13) & _
Chr$(13) & "Scheme: " & stScheme & Chr$(13) & _
Chr$(13) & "Scheme Build Type: " & stSchemeBuildType & Chr$(13) & _
Chr$(13) & "Department: " & stDepartment & Chr$(13) & _
Chr$(13) & "Software House: " & stSoftwarehouse & Chr$(13) & _
Chr$(13) & "Product: " & stProduct & Chr$(13) & _
Chr$(13) & "Details of Request: " & stFulldesofproblem & Chr$(13) & _
Chr$(13) & "Your Request Has been allocated to: " & stAllocatedto & Chr$(13) & _
Chr$(13) & "Category: " & cboCategory & Chr$(13) & _
Chr$(13) & "Priority: " & stPriority & Chr$(13) & _
Chr$(13) & "Expected completion Date: " & stecddate & Chr$(13) & _
Chr$(13) & "Final comments: " & stFinalcomments & Chr$(13) & _
Chr$(13) & "Log Closed: " & stLogclosed & Chr$(13)

'The command below sends the email out
DoCmd.SendObject , , acFormatTXT, stWho, , , stSubject, stText, True


'LValue = DateDiff("d", -45, ECDdateFromTable, Now)

' Exit Sub
' Else
'MsgBox("There are " & intStore & "emails to be sent" &
'vbCrLf & vbCrLf & "Would you like to send them now?", _
'vbYesNo, "You have outstanding emails to be sent...") = vbYes
'Else
'Exit Sub

Else
End If
End If
Else
' equals Yes so check training issue

End If

End Sub

Please could you advise as soon as possible.

For upcoming training course dates see: Pricing & availability

replyReply Thu 19 Aug 2010, 13:44Trainer Jacob said...

RE: Visual Basic Coding to send an reminder when approaching an

Hi Manjeet

Thanks for your post and information provided. We had a look at the only way we can assist is to view your actual working files and troubleshoot the code.

This takes us away from the forum and into consultancy. If you would like to discuss this further please reply to my email.

Kind regards

Jacob

Thu 26 Aug 2010: Automatically marked as resolved.

 

Please browse our web site to find out more about
microsoft access 2002 training and other Microsoft training courses.

Access tip:

Combo box for finding records

You can use a combo box in a form to look up a record. If you place the comb box in the Form header, by then selcting they a field type from the drop down loist, you will see the record for it

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard