Filtered form acts different than unfiltered !"#???

B

Ben

Hi All, and merry xmas...

I created a button to send an automated email and when I open the form
unfiltered from the database window, the button works perfectly. But when I
come from another form via a button with linkcriteria... filtered on a unique
record, the button doesn't work and I get an error.
Error : An expression has wrong datatype...

Here's my code for the button...

Private Sub Kommandoknapp172_Click()

On Error GoTo Err_Kommandoknapp172_Click
Dim stSubject As String
Dim stText As String


stSubject = "Booking without interviewer " & Me.[Booking date] & " - " &
Me.[Booking time] & " For project : " & Me.[Project Initials]
stText = "!!! This is an automatically generated email !!!" & (Chr(10) &
Chr(13)) & "Hej," & (Chr(10) & Chr(13)) & (Chr(10) & Chr(13)) & "Here is the
information on this booking:" & (Chr(10) & Chr(13)) & "Project: " &
Me.Project_Initials & (Chr(10) & Chr(13)) & "Practician: " & Me.First_name &
" " & Me.Last_name & (Chr(10) & Chr(13)) & "Booking: " & Me.[Booking date] &
" - " & Me.[Booking time] & (Chr(10) & Chr(13)) & (Chr(10) & Chr(13)) & "Can
you find an interviewer for this ?" & (Chr(10) & Chr(13)) & (Chr(10) &
Chr(13)) & "Thank you" & (Chr(10) & Chr(13)) & (Chr(10) & Chr(13)) &
CurrentUser() & (Chr(10) & Chr(13)) & Now()


DoCmd.SendObject , , , Me.Project_Manager_email, , , stSubject, stText

Exit_Kommandoknapp172_Click:
Exit Sub

Err_Kommandoknapp172_Click:
Me.Initials.SetFocus
MsgBox Err.Description
Resume Exit_Kommandoknapp172_Click

End Sub



Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top