PDA

View Full Version : send object - string issue



chimp
03-02-2009, 02:56 PM
i think i have this almost to where i want it....

I am trying to set up a sendobject type function, that send info from a table. the table stores id, date etc..

I want he subject line of my email to contain a phrase and the id number held in the table...

table name is
MKT_Lastentry

an the field is called
ID

however i am struggling with one line...


strTitle = "Order Approval required ID Number: " & DlookUp()


i think the issue is the dlookup bit, however not sure how this works.

my code is below.


Option Compare Database

'------------------------------------------------------------
' mcr_emailauto
'
'------------------------------------------------------------
Function mcr_emailauto()

Dim strTitle As String

On Error GoTo mcr_emailauto_Err

strTitle = "Order Approval required ID Number: " & DlookUp()

DoCmd.SendObject acReport, "MKT_Lastentry", "HTML(*.html)", "email@hotmail.com", "moreemails@hotmail.com", "", strTitle, "", False, ""


mcr_emailauto_Exit:
Exit Function

mcr_emailauto_Err:
MsgBox Error$
Resume mcr_emailauto_Exit

End Function

Please help

Andy

CreganTur
03-03-2009, 06:11 AM
The DLookup function requires parameters to work. You have to tell it which field you want to look in and what table to look in. You can also supply WHERE conditionals to further refine the function so it pulls down what you want.

DLookup("ID", "MKT_Lastentry", WHERE Conditional)

Take a look at Access help for more info on the WHERE conditional.

HTH:thumb