Link to home
Start Free TrialLog in
Avatar of rawand ataya
rawand ataya

asked on

I need to separate individual files in a master access report, please help

I need to pull reports in access based on ID and Name, I wrote a vba function but its NOT WORKING. PLease help, also I need help getting it into the actual access report, it creates a module after it debugs then I get a window that says write another code which confuses me. I am a beginner in this language and have a deadline coming up soon. Please help.

Public Sub cmdcreatereportforeachrecordandexport()
Dim MyFileName As String
Dim whr As String
Dim query As String
Dim scriteria As String
Dim GetEmployeeID As String
Dim GetEmployeeName As String
Dim rptrr As Variant
Dim db As Database
Dim rst As Database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("sheet1query")
rs.MoveFirst
MyFileName = "sheet1query"
whr = whr & "WHERE (((sheet1query))"
reptarr = Array("ID,Name")
'run the query and create a record set
Do While .EOF

Set rst = db.OpenRecordset("select [ID],[Name])FROM [sheet1]")
'Resets Query to show ALL records
Loop
Do Until rst.EOF
'save:
DoCmd.OutputTo acOutputReport, "performanceappraisal", acFormatPDF, Format("IDName.pdf")
DoCmd.Close acReport, "performanceappraisal"
rs.MoveNext
Loop
MsgBox "scribe files have completed successfully"

End Sub

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.