ok, basically im sending an email str8 from access.. here is my code.
the bold line shows the date of the job.. due to my initial website form requirements, the date is gathered in 3 drop down menus..
day (numbers 1-31)
month (jan-dec)
year (2006,2007)
so a typical record in my database will have one of these items in the three fields jobday, jobmonth and jobyear
when i send out the email using the above code.. the date is displayed like so...
Job Date: 3 March 2006
what i want to do is make sure that the 'rd' or 'th' or 'st' are included after the day number
so i need some kind of rule in this code like the following..
if Me.jobday = 1 then add st
if Me.jobday = 2 then add nd
if Me.jobday = 3 then add rd
if Me.jobday = 4 then add th
...
...
if Me.jobday = 29 then add th
etc,etc
you get the picture..
i realise that there are probably more advanced date features offered by access that can resolve these problems.. but as i do not have too much time and ability, i was wondering if there was a method like the one i suggested above i could incorporate into this system fairly easily.
thanks in advance.
London Heathrow Cars
Code:
Option Compare Database
Private Sub emailbutton_Click()
On Error GoTo send_Err
Dim strToWhom As String
Dim strMsgBody As String
Dim strSubject As String
strSubject = "London Heathrow Cars - Booking Confirmation"
If Len(Me.emailadd & vbNullString) = 0 Then
MsgBox ("Forgot an email address")
Me.emailadd.SetFocus
Else
strToWhom = Me.emailadd
strMsgBody = "FAO " & Me.title & " " & Me.myname & vbCrLf & vbCrLf & _
"Thank you for your booking request via our website. Details of the requested transfer and our fare are as follows:" & vbCrLf & vbCrLf & _
[b]"Job Date: " & Me.jobday & " " & Me.jobmonth & " " & Me.jobyear & vbCrLf & vbCrLf & _[/b]
"From: " & Me.padd & vbCrLf & _
"Name: " & Me.myname & vbCrLf & _
"Phone: " & Me.phone & vbCrLf & _
"Price: £" & Me.price & vbCrLf & _
".."
DoCmd.SendObject , , , strToWhom, , , strSubject, strMsgBody, True
End If
send_Err:
If Err.Number = 2501 Then
MsgBox "THIS EMAIL HAS NOT BEEN SENT!", vbInformation, "Notice!"
End If
End Sub
the bold line shows the date of the job.. due to my initial website form requirements, the date is gathered in 3 drop down menus..
day (numbers 1-31)
month (jan-dec)
year (2006,2007)
so a typical record in my database will have one of these items in the three fields jobday, jobmonth and jobyear
when i send out the email using the above code.. the date is displayed like so...
Job Date: 3 March 2006
what i want to do is make sure that the 'rd' or 'th' or 'st' are included after the day number
so i need some kind of rule in this code like the following..
if Me.jobday = 1 then add st
if Me.jobday = 2 then add nd
if Me.jobday = 3 then add rd
if Me.jobday = 4 then add th
...
...
if Me.jobday = 29 then add th
etc,etc
you get the picture..
i realise that there are probably more advanced date features offered by access that can resolve these problems.. but as i do not have too much time and ability, i was wondering if there was a method like the one i suggested above i could incorporate into this system fairly easily.
thanks in advance.
London Heathrow Cars