A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Loop Through a Microsoft Access Table



 
 
Thread Tools Display Modes
  #1  
Old June 17th, 2005, 02:34 PM
spenn
external usenet poster
 
Posts: n/a
Default Loop Through a Microsoft Access Table

I am trying to loop through a table and for each record create a snapshot
report. I need to use the name out of the table to save it under that name. I
have the report set up but when you run the report the report is saved as one
big report. I need a report for each. Can Somebody help me?
  #2  
Old June 17th, 2005, 02:45 PM
external usenet poster
 
Posts: n/a
Default

how many tables you got

what exactly are you trying to do?

  #3  
Old June 17th, 2005, 03:03 PM
spenn
external usenet poster
 
Posts: n/a
Default

I have One Table that is pulling all the data. I am trying to make a snapshot
report of each record in the table. Then I am going to use the snapshots for
a website

" wrote:

how many tables you got

what exactly are you trying to do?


  #4  
Old June 17th, 2005, 03:13 PM
spenn
external usenet poster
 
Posts: n/a
Default

I will send you the report if you need to look at it. The information is
about datacards.
my email


" wrote:

how many tables you got

what exactly are you trying to do?


  #5  
Old June 17th, 2005, 05:04 PM
external usenet poster
 
Posts: n/a
Default

gosh i just dont know if you need data warehousign advice-- or if you
need help with Access snapshots

tell me more about what you had in mind

like exporting a report to a SNP format through the command line?

you can make a macro
(docmd. if in vba)
OutputTo outputReport, rptName, acSnp; etc

let me know what you need

  #6  
Old June 17th, 2005, 05:31 PM
spenn
external usenet poster
 
Posts: n/a
Default

can I write a module in access to loop through the table and run the report
for each?

" wrote:

how many tables you got

what exactly are you trying to do?


  #7  
Old June 17th, 2005, 06:28 PM
spenn
external usenet poster
 
Posts: n/a
Default

I know how to export the SNP. I think that I need a module to run the report
for each record and take the title name out of the table and make that the
file name. I need a SNP report for each record that is in the database so
that I can post it on the internet.

Do u think I need to use VB.NEt or can I use a module in access?
And How?

" wrote:

gosh i just dont know if you need data warehousign advice-- or if you
need help with Access snapshots

tell me more about what you had in mind

like exporting a report to a SNP format through the command line?

you can make a macro
(docmd. if in vba)
OutputTo outputReport, rptName, acSnp; etc

let me know what you need


  #8  
Old June 17th, 2005, 06:44 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"spenn" wrote in message

I am trying to loop through a table and for each record create a
snapshot report. I need to use the name out of the table to save it
under that name. I have the report set up but when you run the report
the report is saved as one big report. I need a report for each. Can
Somebody help me?


You can use code something like this "air code":

'----- start of example code -----
Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("YourTable")

With rs
Do Until .EOF

DoCmd.OpenReport "YourReport", acViewPreview, , _
"CustomerID=" & !CustomerID

DoCmd.OutputTo acOutputReport, , acFormatSNP, _
"C:\Temp\" & !CustomerName & ".snp"

DoCmd.Close acReport, "YourReport", acSaveNo

.MoveNext
Loop
.Close
End With
'----- end of example code -----

The code assumes that there is a field named "CustomerID" that is the
(numeric) primary key of table "YourTable", and there's a field named
"CustomerName" that is what you want to use as the name of the output
snapshot file.

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

(please reply to the newsgroup)


  #9  
Old June 17th, 2005, 06:52 PM
spenn
external usenet poster
 
Posts: n/a
Default

Do i put that code in a module in access?

"Dirk Goldgar" wrote:

"spenn" wrote in message

I am trying to loop through a table and for each record create a
snapshot report. I need to use the name out of the table to save it
under that name. I have the report set up but when you run the report
the report is saved as one big report. I need a report for each. Can
Somebody help me?


You can use code something like this "air code":

'----- start of example code -----
Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("YourTable")

With rs
Do Until .EOF

DoCmd.OpenReport "YourReport", acViewPreview, , _
"CustomerID=" & !CustomerID

DoCmd.OutputTo acOutputReport, , acFormatSNP, _
"C:\Temp\" & !CustomerName & ".snp"

DoCmd.Close acReport, "YourReport", acSaveNo

.MoveNext
Loop
.Close
End With
'----- end of example code -----

The code assumes that there is a field named "CustomerID" that is the
(numeric) primary key of table "YourTable", and there's a field named
"CustomerName" that is what you want to use as the name of the output
snapshot file.

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

(please reply to the newsgroup)



  #10  
Old June 17th, 2005, 07:04 PM
spenn
external usenet poster
 
Posts: n/a
Default

i tried that code it says syntax error. here is the code can u tell me
whats wrong?
thanks
DATACARDS SORT FORM is the table
I am getting an error on the openReport
The field that i need is Datacard Title.
I am getting error on the output to I need the datacard title to be the save
name.
Dim rs As DAO.Recordset

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

With rs
Do Until .EOF

DoCmd.OpenReport "Datacard Report", acViewPreview, , _
"Datacard Title=" & !Datacard Title

DoCmd.OutputTo acOutputReport, , acFormatSNP, _
"C:\Temp\" & !Datacard Title & ".snp"

DoCmd.Close acReport, "Datacard Report", acSaveNo

.MoveNext
Loop
.Close
End With

"Dirk Goldgar" wrote:

"spenn" wrote in message

I am trying to loop through a table and for each record create a
snapshot report. I need to use the name out of the table to save it
under that name. I have the report set up but when you run the report
the report is saved as one big report. I need a report for each. Can
Somebody help me?


You can use code something like this "air code":

'----- start of example code -----
Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("YourTable")

With rs
Do Until .EOF

DoCmd.OpenReport "YourReport", acViewPreview, , _
"CustomerID=" & !CustomerID

DoCmd.OutputTo acOutputReport, , acFormatSNP, _
"C:\Temp\" & !CustomerName & ".snp"

DoCmd.Close acReport, "YourReport", acSaveNo

.MoveNext
Loop
.Close
End With
'----- end of example code -----

The code assumes that there is a field named "CustomerID" that is the
(numeric) primary key of table "YourTable", and there's a field named
"CustomerName" that is what you want to use as the name of the output
snapshot file.

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

(please reply to the newsgroup)



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2002 vs 2003 Patrick Stubbin General Discussion 2 May 17th, 2005 07:27 AM
Access combo box-show name, not ID, in table? write on New Users 30 April 30th, 2005 09:11 PM
Many-to-many implementation problem Al Williams Database Design 15 April 29th, 2005 05:19 PM
transpose john Using Forms 1 November 24th, 2004 06:16 PM
Adding staff photographs to my database KK New Users 2 September 3rd, 2004 07:41 AM


All times are GMT +1. The time now is 04:00 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.