2003 code not working in 2007 database

L

Leslie

I have this code on a command button on a form what it did in 2003 was
generate an excel spreadsheet and bring up the e-mail command so this report
could be e-mailed to outside vendor.

Now when runing the code the debug comes up and highlights the send object
line of code (docmd.sendobject) we have just this week upgraded to 2007 and
while I will be upgrading databases on an on-going schedule, this one is
still 2003 format. Please let me know what I can do to get the code to work.
This one is next to be upgraded to 2007, but I want the code working before
I upgrade or at least have an idea of what I need to do. When it runs I get
runtime error 2282. and if I choose the debug choice it highlights the
doCmd.SendObject line of code.

Here's the entire code for this command button:

Private Sub OpnVendorMRVs_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'E-Mail Vendor to update MRV's.
Dim stDocName As String, strsql As String
Dim Origvar As String, Coord As String
Coord = Buyer
Origvar = EMail
stDocName = "Vendor Open Returns"
strsql = "select * from TBL_Vendor where [Vnbr]=Forms!FRM_Vendor.VNBR"
DoCmd.OpenReport stDocName, acViewPreview, strsql
DoCmd.SendObject , AcSendObject, stDocName, acFormatXLS, Origvar, Coord,
"RGA-NCM", "Open MRV's", "Please provide an update on the attached
outstanding MRV's. A response must be provided within 15 days from the date
of this e-mail, the comments section of the spreadsheet is provided for your
updated information. Please complete the comments section and e-mail the
spreadsheet back to me."
Exit_OpnVendorMRVs_Click:
Exit Sub
Err_OpnVendorMRVs_Click:
MsgBox Err.Description
Resume Exit_OpnVendorMRVs_Click
End Sub

Thank you for any assistance.
 
L

Leslie

Thank you for the response but that is not going to help me we are not moving
to SQL Server anytime soon so I need to know how to fix this issue.

they pulled jet out of Access 2007, you need to move to SQL Server



I have this code on a command button on a form what it did in 2003 was
generate an excel spreadsheet and bring up the e-mail command so this report
could be e-mailed to outside vendor.

Now when runing the code the debug comes up and highlights the send object
line of code (docmd.sendobject) we have just this week upgraded to 2007 and
while I will be upgrading databases on an on-going schedule, this one is
still 2003 format. Please let me know what I can do to get the code to work.
This one is next to be upgraded to 2007, but I want the code working before
I upgrade or at least have an idea of what I need to do. When it runs I get
runtime error 2282. and if I choose the debug choice it highlights the
doCmd.SendObject line of code.

Here's the entire code for this command button:

Private Sub OpnVendorMRVs_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'E-Mail Vendor to update MRV's.
Dim stDocName As String, strsql As String
Dim Origvar As String, Coord As String
Coord = Buyer
Origvar = EMail
stDocName = "Vendor Open Returns"
strsql = "select * from TBL_Vendor where [Vnbr]=Forms!FRM_Vendor.VNBR"
DoCmd.OpenReport stDocName, acViewPreview, strsql
DoCmd.SendObject , AcSendObject, stDocName, acFormatXLS, Origvar, Coord,
"RGA-NCM", "Open MRV's", "Please provide an update on the attached
outstanding MRV's. A response must be provided within 15 days from the date
of this e-mail, the comments section of the spreadsheet is provided for your
updated information. Please complete the comments section and e-mail the
spreadsheet back to me."
Exit_OpnVendorMRVs_Click:
Exit Sub
Err_OpnVendorMRVs_Click:
MsgBox Err.Description
Resume Exit_OpnVendorMRVs_Click
End Sub

Thank you for any assistance.
 
L

Lynn Trapp

Private Sub OpnVendorMRVs_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'E-Mail Vendor to update MRV's.
Dim stDocName As String, strsql As String
Dim Origvar As String, Coord As String
Coord = Buyer
Origvar = EMail
stDocName = "Vendor Open Returns"
strsql = "select * from TBL_Vendor where [Vnbr]=Forms!FRM_Vendor.VNBR"
DoCmd.OpenReport stDocName, acViewPreview, strsql
DoCmd.SendObject , AcSendObject, stDocName, acFormatXLS, Origvar, Coord,
Thank you for any assistance.


Try changing the SendObject line to this:

DoCmd.SendObject, AcSendReport, stDocName, acFormatXLS....

Lynn Trapp
www.ltcomputerdesigns.com
 
B

BruceM

You should always assume that Aaron is wrong.

Leslie said:
Thank you for the response but that is not going to help me we are not
moving
to SQL Server anytime soon so I need to know how to fix this issue.

they pulled jet out of Access 2007, you need to move to SQL Server



I have this code on a command button on a form what it did in 2003 was
generate an excel spreadsheet and bring up the e-mail command so this
report
could be e-mailed to outside vendor.

Now when runing the code the debug comes up and highlights the send
object
line of code (docmd.sendobject) we have just this week upgraded to 2007
and
while I will be upgrading databases on an on-going schedule, this one
is
still 2003 format. Please let me know what I can do to get the code to
work.
This one is next to be upgraded to 2007, but I want the code working
before
I upgrade or at least have an idea of what I need to do. When it runs
I get
runtime error 2282. and if I choose the debug choice it highlights the
doCmd.SendObject line of code.

Here's the entire code for this command button:

Private Sub OpnVendorMRVs_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'E-Mail Vendor to update MRV's.
Dim stDocName As String, strsql As String
Dim Origvar As String, Coord As String
Coord = Buyer
Origvar = EMail
stDocName = "Vendor Open Returns"
strsql = "select * from TBL_Vendor where
[Vnbr]=Forms!FRM_Vendor.VNBR"
DoCmd.OpenReport stDocName, acViewPreview, strsql
DoCmd.SendObject , AcSendObject, stDocName, acFormatXLS, Origvar,
Coord,
"RGA-NCM", "Open MRV's", "Please provide an update on the attached
outstanding MRV's. A response must be provided within 15 days from the
date
of this e-mail, the comments section of the spreadsheet is provided for
your
updated information. Please complete the comments section and e-mail
the
spreadsheet back to me."
Exit_OpnVendorMRVs_Click:
Exit Sub
Err_OpnVendorMRVs_Click:
MsgBox Err.Description
Resume Exit_OpnVendorMRVs_Click
End Sub

Thank you for any assistance.
 
L

Leslie

I will do that, thank you for the help.

Lynn Trapp said:
Private Sub OpnVendorMRVs_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'E-Mail Vendor to update MRV's.
Dim stDocName As String, strsql As String
Dim Origvar As String, Coord As String
Coord = Buyer
Origvar = EMail
stDocName = "Vendor Open Returns"
strsql = "select * from TBL_Vendor where [Vnbr]=Forms!FRM_Vendor.VNBR"
DoCmd.OpenReport stDocName, acViewPreview, strsql
DoCmd.SendObject , AcSendObject, stDocName, acFormatXLS, Origvar, Coord,
Thank you for any assistance.


Try changing the SendObject line to this:

DoCmd.SendObject, AcSendReport, stDocName, acFormatXLS....

Lynn Trapp
www.ltcomputerdesigns.com
 
L

Leslie

I tried the suggestion but apparently the ability to send a report to excel
from the report preview screen or any report screen has been removed.

Leslie said:
I will do that, thank you for the help.

Lynn Trapp said:
Private Sub OpnVendorMRVs_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'E-Mail Vendor to update MRV's.
Dim stDocName As String, strsql As String
Dim Origvar As String, Coord As String
Coord = Buyer
Origvar = EMail
stDocName = "Vendor Open Returns"
strsql = "select * from TBL_Vendor where [Vnbr]=Forms!FRM_Vendor.VNBR"
DoCmd.OpenReport stDocName, acViewPreview, strsql
DoCmd.SendObject , AcSendObject, stDocName, acFormatXLS, Origvar, Coord,
Thank you for any assistance.


Try changing the SendObject line to this:

DoCmd.SendObject, AcSendReport, stDocName, acFormatXLS....

Lynn Trapp
www.ltcomputerdesigns.com
 

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