RE: Print current selected record to a report



Ok, I got it printing out the current record ok now, but it won't print out
all the fields. Only about half the fields where I entered data are printing
out, the rest are just blank. I used the code you posted for me.

"Duane Hookom" wrote:

Can you confirm or deny that your current form is named
"frmFinancialAssesment"? I would expect the SSN to be stored in a text field
on the current form. This would make your

Private Sub cmdPrintCurrentFA_Click()
On Error GoTo Err_cmdPrintCurrentReport_Click

Dim stDocName As String
Dim stWhere As String

stDocName = "rptFinancialAssesment"
stWhere = "infSSN ='" & Me.infSSN & "'"

DoCmd.OpenReport "rptFinancialAssesment", , , strWhere

Exit_cmdPrintCurrentReport_Click:
Exit Sub

Err_cmdPrintCurrentReport_Click:
MsgBox Err.Description
Resume Exit_cmdPrintCurrentReport_Click
End Sub

--
Duane Hookom
Microsoft Access MVP


"robertm600635" wrote:

I need to print olny the current selected record on my form to a report. I'm
using the following code:

Private Sub cmdPrintCurrentFA_Click()
On Error GoTo Err_cmdPrintCurrentReport_Click

Dim stDocName As String
Dim stWhere As String

stDocName = "rptFinancialAssesment"

DoCmd.OpenReport "rptFinancialAssesment", , ,
"[infSSN]=Forms!frmFinancialAssesment!infSSN"

Exit_cmdPrintCurrentReport_Click:
Exit Sub

Err_cmdPrintCurrentReport_Click:
MsgBox Err.Description
Resume Exit_cmdPrintCurrentReport_Click
End Sub
---
When I print it prompts me for input. the msg box says
"Forms!frmFinancialAssesment!infSSN"
I'm guessing it want me to input the infSSN (social security number, which
is the primary key) Any way i can just get it to print the report for the
current selected record without inputing anything?
.



Relevant Pages