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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Records From A Form 1

Status
Not open for further replies.

MelissaT

Programmer
May 16, 2002
67
US
I have a database that users are going to be searching thru. They select a search criteria and a screen comes up with the results. I would like to able to print that list of results. The problem is, the users can actually view ALL of the records if they want, and I don't want them to be able to print that whole list. It would just be too big of a report. Is there a way, for example, that I can say on load of the form if there is more than 50 records, don't show my Print button? Melissa
Designing Access databases since 1999
 
Hi

If Mr.RecordCount > 50 Then
cmdPrint.Visible = false
Else
cmdPrint.Visible = True
End If

in form load event
Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Hi

OOPS! should have been

Hi

If Me.RecordCount > 50 Then
cmdPrint.Visible = false
Else
cmdPrint.Visible = True
End If

in form load event
Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
You can also make it so that your user only prints the current record if you like with the following:
Code:
Private Sub PrintForm_Click()
On Error GoTo Err_Print_Click


    DoCmd.PrintOut acSelection 'prints current record

Exit_Print_Click:
    Exit Sub

Err_Print_Click:
    MsgBox Err.Description
    Resume Exit_Print_Click
    
End Sub
 
Ken,

I tried that, but I get a compiler error saying "Method or data member not found.", on the RecordCount. Melissa
Designing Access databases since 1999
 
Hi

OK my apologies

make it

If Me.recordsetclone.RecordCount > 50 Then
cmdPrint.Visible = false
Else
cmdPrint.Visible = True
End If

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Works! Great!

Thanks Melissa
Designing Access databases since 1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top