how to print a single form

deema

Registered User.
Local time
Yesterday, 16:04
Joined
Jul 31, 2012
Messages
14
hello


I have created forms and now I want to print it. But I want to print it as a single form. I dont want all the forms to be printed.
I only want to select a primary key then print the form that belongs to that primary key.

I enter this code

Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ID1] = " & Me.[ID1]
DoCmd.OpenReport "database", acViewPreview, , strWhere
End If

but it keeps giving me this error
as in attachment


appreciate your help...
 

Attachments

  • error.jpg
    error.jpg
    46.4 KB · Views: 70
Hi Deema,

Why are you trying to print a form? You should only be printing reports. Build a report that would filter based on that primary key.
 
thank you I will try to convert it to report
 
Could you please explain how to do it using reports??
 
by the way, you can also create a button that prompts you to select the record you want to print in form view...using the wizard will guide you through that.
 
thank you very much! you guys are really helpful
 

Users who are viewing this thread

Back
Top Bottom