error 2495

message from David on 27 May 2004
What would cause this error after executing a sub from a funtion?

The action or method requires a Table Name argument
***********
The sub runs fine by itself.

Function GetReleases()
NewKits
End Function

Thanks,
David
 
Ken Snell replied to David on 27 May 2004
Just a guess, but probably an action or method that is being called/used in
the sub requires a Table Name argument.

Seriously, can you provide a bit more info? What is the code in the NewKits
subroutine?
 
David replied to Ken Snell on 28 May 2004
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
"Ken Snell" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
news:OD4owfFREHA.3944@tk2msftngp13.phx.gbl...
 
Ken Snell replied to David on 28 May 2004
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
 
David replied to Ken Snell on 28 May 2004
Thanks so much, Ken. I replaced my code with yours, and it worked great. I
also just put all the code under the _click sub instead of having the click
call a function which called the sub with my code, and that eliminated the
error message at the end (still don't know why it did that, table names were
all good). Plus, I've been wanting to figure out how to use SQL statements
like yours in Access/Excel code, since I use SQL for all my personal
queries, so now I've got a start.

Thanks!
David

"Ken Snell" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
news:u6M$SzPREHA.3348@TK2MSFTNGP09.phx.gbl...
 

Archived message: error 2495 (MS Access)