OBJECTIVE: Print PDF to file, each record should be a file name =PID (field) - have code issue belo

  • Thread starter Thread starter S Himmelrich
  • Start date Start date
S

S Himmelrich

I've reviewed google groups for solution, most of the post are
directing to broken links.....here is my attempt at the code, which is
erroring out with 'can't find field "|" referred to in your
expression'.

HERE IS THE CODE (which I found online):

Private Sub Command463_Click()
On Error GoTo Err_Command463_Click

Dim PIDNumber As String
Dim Sql As String
Dim rs As Recordset

Sql = "SELECT * FROM " & [One Pager Status Reports] & " ORDER BY PID"

Set rs = CurrentDb.OpenRecordset(Sql)

With rs

..MoveLast
..MoveFirst

Do Until .EOF = True

PIDNumber = !PID
DoCmd.OutputTo acReport, "Portfolio Project Status Report"

..MoveNext
Loop

End With
rs.Close


'--------Report Open Event (Report1)--------------
Me.caption = PIDNumber

Me.RecordSource = "SELECT * FROM " & [One Pager Status Reports] & "
WHERE PID = '" & PIDNumber & "'"

Exit_Command463_Click:
Exit Sub

Err_Command463_Click:
MsgBox Err.Description
Resume Exit_Command463_Click

End Sub
 
I've reviewed google groups for solution, most of the post are
directing to broken links.....here is my attempt at the code, which is
erroring out with 'can't find field "|" referred to in your
expression'.

HERE IS THE CODE (which I found online):

Private Sub Command463_Click()
On Error GoTo Err_Command463_Click

Dim PIDNumber As String
Dim Sql As String
Dim rs As Recordset

Sql = "SELECT * FROM "& [One Pager Status Reports]& " ORDER BY PID"

Set rs = CurrentDb.OpenRecordset(Sql)

With rs

.MoveLast
.MoveFirst

Do Until .EOF = True

PIDNumber = !PID
DoCmd.OutputTo acReport, "Portfolio Project Status Report"

.MoveNext
Loop

End With
rs.Close


'--------Report Open Event (Report1)--------------
Me.caption = PIDNumber

Me.RecordSource = "SELECT * FROM "& [One Pager Status Reports]& "
WHERE PID = '"& PIDNumber& "'"

Exit_Command463_Click:
Exit Sub

Err_Command463_Click:
MsgBox Err.Description
Resume Exit_Command463_Click

End Sub

I think you need to wrap ["One Pager Status Report"] as it has spaces.

HTH
Mick.
 
I've reviewed google groups for solution, most of the post are
directing to broken links.....here is my attempt at the code, which is
erroring out with 'can't find field "|" referred to in your
expression'.
HERE IS THE CODE (which I found online):
Private Sub Command463_Click()
On Error GoTo Err_Command463_Click
Dim PIDNumber As String
Dim Sql As String
Dim rs As Recordset
Sql = "SELECT * FROM "&  [One Pager Status Reports]&  " ORDER BY PID"
Set rs = CurrentDb.OpenRecordset(Sql)
With rs

Do Until .EOF = True
PIDNumber = !PID
DoCmd.OutputTo acReport, "Portfolio Project Status Report"

End With
rs.Close
'--------Report Open Event (Report1)--------------
Me.caption = PIDNumber
Me.RecordSource = "SELECT * FROM "&  [One Pager Status Reports]&  "
WHERE PID = '"&  PIDNumber&  "'"
Exit_Command463_Click:
     Exit Sub
Err_Command463_Click:
     MsgBox Err.Description
     Resume Exit_Command463_Click

I think you need to wrap ["One Pager Status Report"] as it has spaces.

HTH
Mick.- Hide quoted text -

- Show quoted text -

Tried that, same error
 
Back
Top