Loop Through a Microsoft Access Table

S

spenn

Can u help me ? look at the last to post messages. I am using Microsoft
Access 2003

Dirk Goldgar said:
spenn said:
Thanks for all the help but I have another problem

here is the code:

Public Sub outputreport()
'DoCmd.OutputTo acOutputReport, "Dataards Report", acFormatSNP,
CurrentProject.Path

Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("DATACARD FORM SORT")

With rs
Do Until .EOF
DoCmd.OpenReport "Datacards Report", acViewPreview, , _
"[Datacard Title]=" & _
Chr(34) & ![Datacard Title] & Chr(34)


'DoCmd.OpenReport "Datacards Report", acViewPreview, , _
"Datacard Title=" & ![Datacard Title]

DoCmd.OutputTo acOutputReport, "Datacards Report",
acFormatSNP, _ "C:\Documents and
Settings\Owner\Desktop\New Folder" & ![Datacard Title] & ".snp"



DoCmd.Close acReport, "Datacard Report", acSaveNo

.MoveNext
Loop
.Close
End With


End Sub



the error says: The OutputTo action was canceled.
the screen comes up and says out puting then the error message comes
up. can u help me
thanks

A simplified version of that code works for me. Two things occur to me.
First, I think you need a back-slash on the end of the folder path when
you build your output file name, like this:

"C:\Documents and Settings\Owner\Desktop\New Folder\"
& ![Datacard Title] & ".snp"

Second, have you inspected the values of [Datacard Title] to make sure
that they are all valid for file names? There are characters that a
Windows file name cannot contain.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dirk Goldgar

spenn said:
The Problem it is throwing is error 2501 Invalid page.

"Invalid page." Really? Where is that showing up?
Run-time error 2501:
The OutputTo action was canceled.

That's more what I would expect, if there's a problem.
here is the code:

Public Sub outputreport()


Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("DATACARD FORM SORT")

With rs
Do Until .EOF
DoCmd.OpenReport "Datacards Report", acViewPreview, , _
"[Datacard Title]=" & _
Chr(34) & ![Datacard Title] & Chr(34)

DoCmd.OutputTo acOutputReport, "Datacards Report",
acFormatSNP, _ "C:\Documents and
Settings\Owner\Desktop\New
Folder\" & ![Datacard Title] & ".snp"

DoCmd.Close acReport, "Datacard Report", acSaveNo

.MoveNext
Loop
.Close
End With

End Sub

As I said, very similar code works for me. Make sure the output folder
already exists. If that's not the problem, try replacing the constant
acFormatSNP, with the string literal "Snapshot Format (*.snp)":

DoCmd.OutputTo acOutputReport, _
"Datacards Report", _
"Snapshot Format (*.snp)", _
"C:\Documents and Settings\Owner\Desktop\" & _
"New Folder\" & ![Datacard Title] & ".snp"

If that doesn't work, open the report manually and make sure you can use
the File -> Export... menu item to save it to snapshot format.
 
D

Dirk Goldgar

spenn said:
Can u help me ? look at the last to post messages. I am using
Microsoft Access 2003

Have some patience, please. This is a newsgroup, not a chat room.
 
S

spenn

hi,
have a problem when I run the report , I get a error message saying:
run time error
2024
Not enough free disk space for tempary work file

can u help?
 
D

Dirk Goldgar

spenn said:
hi,
have a problem when I run the report , I get a error message saying:
run time error
2024
Not enough free disk space for tempary work file

can u help?

Not unless you satisfy my curiosity by telling me what fixed your
original problem. Come on, help us out here. Other people, searching
these groups for solutions to a similar problem, may be helped by your
answer.

But also, see this KnowledgeBase article:

http://support.microsoft.com/default.aspx?scid=kb;en-us;226526
 
S

spenn

The database that I am working on had pictures in the database which was on
the network. So, I got on the network and it worked. Plus add the \ to the
end of the file path.
thanks
 
D

Dirk Goldgar

spenn said:
The database that I am working on had pictures in the database which
was on the network. So, I got on the network and it worked. Plus add
the \ to the end of the file path.

Thanks for explaining. Did the KB article I posted to your followup
question resolve the issue for you?
 
S

spenn

I am trying to use the same web page to display the reports. I have a
hyperlink and when the user clicks it should take them to this web page and
display the report.
I was thinking useing javascript to insert the value that you get for the
hyperlink parameters.

Can u do this?
 
D

Dirk Goldgar

spenn said:
I am trying to use the same web page to display the reports. I have a
hyperlink and when the user clicks it should take them to this web
page and display the report.
I was thinking useing javascript to insert the value that you get for
the hyperlink parameters.

Can u do this?

I don't really understand what you're asking. What web page? Where did
a web page come into this? Would this web page be accessed over the
Internet, or only via a local company intranet?

It seems to me this is really a new question, and maybe should be asked
in a new discussion thread. But if you post more complete details of
what you're trying to achieve, I may either be able to help you or be
able to tell you that I can't.
 

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