Guessing here, but is "tblNewKitsWithPrintComp" in the last SendObject step
the correct name of the table in the database?
Side note: Any particular reason you are not using an append query to copy
the data from the first table to the second, instead of opening the tables
and using RunCommand actions? Such as this (this assumes that the field
names are the same in both tables and are in the same order):
Dim dbs As DAO.Database
Dim strSQL As String
Set dbs = CurrentDb
DoCmd.RunMacro "mroNewReleaseFinal"
If DCount("*", "tblNewReleasesFinal") > 0 Then
strSQL = "INSERT INTO [Released Kits] " & _
"SELECT A.* FROM tblNewReleasesFinal " & _
"AS A;"
dbs.Execute strSQL, dbFailOnError
Else
MsgBox "No new releases for report run at " & Now(), vbOKOnly
End If
dbs.Close
Set dbs = Nothing
' continue with your Send Object code
' ......
--
Ken Snell
<MS ACCESS MVP>
David said:
Sorry, here's the code for the sub:
++++++++++++++++++++++++++++++++++=
Sub NewKits()
Dim RelNum
DoCmd.SetWarnings False
DoCmd.RunMacro "mroNewReleaseFinal"
DoCmd.OpenTable "tblNewReleasesFinal"
RelNum = DCount("*", "tblNewReleasesFinal")
If RelNum = 0 Then
DoCmd.Close acTable, "tblNewReleasesFinal"
MsgBox "No new releases for report run at " & Now(), vbOKOnly
DoCmd.SetWarnings True
Else
RunCommand (acCmdSelectAllRecords)
RunCommand (acCmdCopy)
DoCmd.OpenTable "Released Kits"
RunCommand (acCmdPasteAppend)
DoCmd.Close acTable, "Released Kits"
DoCmd.Close acTable, "tblNewReleasesFinal"
DoCmd.SendObject acSendTable, objectname:="tblNewReleasesFinal",
to:="xxxxxx", cc:="yyyyy", subject:="New Releases", _
messagetext:="yyyyy, add any Safedisc or DVD releases to appropriate tab in
GPS." _
, outputformat:="HTML", editmessage:=False
DoCmd.SendObject acSendTable, objectname:="tblNewKitsWithPrintComp",
to:="xxxxx", cc:="yyyyy", subject:="New Releases with Print Components", _
messagetext:="xxxxx, please download and store these new kits." _
, outputformat:="HTML", editmessage:=False
DoCmd.SetWarnings True
End If
End Sub
+++++++++++++++++++++++++++++
I really appreciate your help, this is really annoying me...
Thanks,
David
called/used
in