Extracting Data

F

Fie

Hi,

I am trying to extract data from Access 97 to Excel 97. I have set up
a button on my form that allows the user to extract date, but when it
runs it to extract an error message comes up.


There is an invalid use of the . (dot) or ! operator or invalid
parentheses.
You may have entered an invalid indentifier or typed parentheses
folling the Null constant.


Does anyone know what this means? or how I can over come it.

The code in the button is

Private Sub Command60_Click()
On Error GoTo Err_Command60_Click

Dim stDocName As String

stDocName = "rptMetal"
DoCmd.OutputTo acReport, stDocName

Exit_Command60_Click:
Exit Sub

Err_Command60_Click:
MsgBox Err.Description
Resume Exit_Command60_Click

End Sub


and the SQL in the query is

SELECT tblAddData.MetalTicket, tblAddData.MetalWeight,
tblAddData.MetalWilliamson, tblAddData.MetalSite, tblAddData.Date,
Format([Date],"mmmm") AS Month, tblAddData.MetalOther
FROM tblAddData
WHERE (((tblAddData.MetalTicket)>"0"));


Fiona
 
J

John W. Vinson

Private Sub Command60_Click()
On Error GoTo Err_Command60_Click

Dim stDocName As String

stDocName = "rptMetal"
DoCmd.OutputTo acReport, stDocName

Exit_Command60_Click:
Exit Sub

Err_Command60_Click:
MsgBox Err.Description
Resume Exit_Command60_Click

End Sub


and the SQL in the query is

SELECT tblAddData.MetalTicket, tblAddData.MetalWeight,
tblAddData.MetalWilliamson, tblAddData.MetalSite, tblAddData.Date,
Format([Date],"mmmm") AS Month, tblAddData.MetalOther
FROM tblAddData
WHERE (((tblAddData.MetalTicket)>"0"));

There's nothing blatantly obvious here. If you open the Query
directly, do you see the data that you expect? I presume that you want
to output the results on the report named rptMetall, and get prompted
for the output format and the filename (since you don't specify them);
is rptMetal open at the time you run this? If you open rptMetal
directly, do you get any errors?

John W. Vinson [MVP]
 

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

Similar Threads

Extracting Data 2

Top