Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping trough the recordset

Status
Not open for further replies.

teqtaq

Technical User
Nov 18, 2007
197
US
Can someone please, help me with following.
I had created serious of Reports and now one person suppose to run them for all and save in pdf format and send out and it takes about 3 hours.

I remember I use to write code that was reading recordset with names and printing each Report witht he name of the recipient and saving it in a given directory.

I think it is 3 functions.

Looping trough Rs and Saving with given name
Printing to a pdf...

Can you please, help me with a loop idea - is it do while or some other loop?
I think I use to have
i+1 as a counter and than do while loop

Thanks
 
I wrote the function and I am running it from ActualName.mdb

So when I write

Call PrintReport (it is a module)

it goes to that PrintReport Sub and I have there
Set dbsCurrent = CurrentDatabase() 'OpenDatabase("ActualName.mdb")

I had decided if I am already IN current database - I do not need to give a name, correct?

So why do I get the message Sub or Function not defined on CurrentDatabase()
 
All right...

I have

With qdfActiveRecruiter
sqlRecNameS = "SELECT DISTINCT Candidate.Name_Display FROM Candidate ORDER BY Name_Display "
Set rstRS = CurrentDb.OpenRecordset(sqlRecNameS, dbOpenSnapshot)
rstRS.MoveFirst
End With

' Build the output string.
With rstRS
Do While Not .EOF
sqlRecNameS = sqlRecNameS '& " " & FileName & " " & FileDate
'!au_id & ": $" & (10 * !royaltyper) & vbCr
.MoveNext
Loop
End With

My Loop is counting correctly 20 records BUT sqlRecNameS is not showing any. Why? Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top