Run-Time Error '424' Object required

G

GTVT06

I'm getting a Run-Time Error '424' Object required error on Ln 7, Col
1 when running the following macro. I'm attempting to open a Query and
export it and name the file name qryEvansDailyRTA & whatever the Date
is in the Date column of the query.xls I cant figure out what's
causing the error. Any assistance is greatly appreciated.

Sub Export_RTA()
Dim FileName As String


DoCmd.OpenQuery "qryEvansDailyRTA"
FileName = "T:\Departments\Operations\WFM\RTA eWFM ASC Daily Reports
\Evans\DailyRTABreaks\MAR\""qryEvansDailyRTA" & Queries!
[qryEvansDailyRTA]![Date] & ".xls"
DoCmd.OutputTo acOutputQuery, "qryEvansDailyRTA", acFormatXLS,
FileName, False, False, False
DoCmd.Close acOutputQuery, "qryEvansDailyRTA"
End Sub
 
G

GTVT06

I'm getting the error on this part
FileName = "T:\Departments\Operations\WFM\RTA eWFM ASC Daily Reports
\Evans\DailyRTABreaks\MAR""\" & "qryEvansDailyRTA" & Queries!
[qryEvansDailyRTA]![Date] & ".xls"
I tried looking in Access help but they don't have Access Help
installed on my work computer.
 
G

GTVT06

looks like
Queries![qryEvansDailyRTA]![Date] = <Object Required>



Hi,
do you mean this line:
DoCmd.Close acOutputQuery, "qryEvansDailyRTA"

then first parameter is incorrect, check access help for more info

--
Best regards,
___________
Alex Dybenko (MVP)http://alexdyb.blogspot.comhttp://www.PointLtd.com




I'm getting a Run-Time Error '424' Object required error on Ln 7, Col
1 when running the following macro. I'm attempting to open a Query and
export it and name the file name qryEvansDailyRTA & whatever the Date
is in the Date column of the query.xls I cant figure out what's
causing the error. Any assistance is greatly appreciated.
Sub Export_RTA()
Dim FileName As String
DoCmd.OpenQuery "qryEvansDailyRTA"
FileName = "T:\Departments\Operations\WFM\RTA eWFM ASC Daily Reports
\Evans\DailyRTABreaks\MAR\""qryEvansDailyRTA" & Queries!
[qryEvansDailyRTA]![Date] & ".xls"
DoCmd.OutputTo acOutputQuery, "qryEvansDailyRTA", acFormatXLS,
FileName, False, False, False
DoCmd.Close acOutputQuery, "qryEvansDailyRTA"
End Sub- Hide quoted text -

- Show quoted text -
 
D

Douglas J. Steele

You can't refer to fields in a query like that.

Try:

DLookup("[Date]", "[qryEvansDailyRTA]")

BTW, Date is a bad choice of field name. It's a reserved word, and using
reserved words for your own purposes can lead to problems.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


GTVT06 said:
looks like
Queries![qryEvansDailyRTA]![Date] = <Object Required>



Hi,
do you mean this line:
DoCmd.Close acOutputQuery, "qryEvansDailyRTA"

then first parameter is incorrect, check access help for more info

--
Best regards,
___________
Alex Dybenko (MVP)http://alexdyb.blogspot.comhttp://www.PointLtd.com




I'm getting a Run-Time Error '424' Object required error on Ln 7, Col
1 when running the following macro. I'm attempting to open a Query and
export it and name the file name qryEvansDailyRTA & whatever the Date
is in the Date column of the query.xls I cant figure out what's
causing the error. Any assistance is greatly appreciated.
Sub Export_RTA()
Dim FileName As String
DoCmd.OpenQuery "qryEvansDailyRTA"
FileName = "T:\Departments\Operations\WFM\RTA eWFM ASC Daily Reports
\Evans\DailyRTABreaks\MAR\""qryEvansDailyRTA" & Queries!
[qryEvansDailyRTA]![Date] & ".xls"
DoCmd.OutputTo acOutputQuery, "qryEvansDailyRTA", acFormatXLS,
FileName, False, False, False
DoCmd.Close acOutputQuery, "qryEvansDailyRTA"
End Sub- Hide quoted text -

- Show quoted text -
 
G

GTVT06

That worked!!! Thanks!!!


You can't refer to fields in a query like that.

Try:

DLookup("[Date]", "[qryEvansDailyRTA]")

BTW, Date is a bad choice of field name. It's a reserved word, and using
reserved words for your own purposes can lead to problems.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)




looks like
Queries![qryEvansDailyRTA]![Date] = <Object Required>
Hi,
do you mean this line:
DoCmd.Close acOutputQuery, "qryEvansDailyRTA"
then first parameter is incorrect, check access help for more info
--
Best regards,
___________
Alex Dybenko (MVP)http://alexdyb.blogspot.comhttp://www.PointLtd.com

I'm getting a Run-Time Error '424' Object required error on Ln 7, Col
1 when running the following macro. I'm attempting to open a Query and
export it and name the file name qryEvansDailyRTA & whatever the Date
is in the Date column of the query.xls I cant figure out what's
causing the error. Any assistance is greatly appreciated.
Sub Export_RTA()
Dim FileName As String
DoCmd.OpenQuery "qryEvansDailyRTA"
FileName = "T:\Departments\Operations\WFM\RTA eWFM ASC Daily Reports
\Evans\DailyRTABreaks\MAR\""qryEvansDailyRTA" & Queries!
[qryEvansDailyRTA]![Date] & ".xls"
DoCmd.OutputTo acOutputQuery, "qryEvansDailyRTA", acFormatXLS,
FileName, False, False, False
DoCmd.Close acOutputQuery, "qryEvansDailyRTA"
End Sub- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
 

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