|
-
Feb 8th, 2011, 02:30 AM
#1
Thread Starter
Addicted Member
[RESOLVED] print button
hi ,
i have a form that has records like: name, cpr, phone num, description , etc) , i want to put a print button, when i click on the print button i want it to print the current record i stopped at as a report in access, how can i do this?
Thankx in advance
Code:
Private Sub cmdreport_Click()
'Form5.Show
'Form3.Hide
Dim dbName As String
Dim rptName As String
Dim Preview As Long
Const acNormal = 0
Const acPreview = 2
dbName = "\\10.70.34.7\it2\PMEW\PROJECTS\Billing System\revenue\rev system\LoginExample\Users.mdb"
rptName = "viewreport"
Preview = acPreview 'acNormal
With objAccess
.OpenCurrentDatabase filepath:=dbName
If Preview = acPreview Then
.Visible = True
.DoCmd.OpenReport rptName, Preview
Else
.DoCmd.OpenReport rptName
End If
End With
End Sub
this code is working, but i want it to print the current record.
-
Feb 8th, 2011, 09:05 AM
#2
Re: print button
After you open report use DoCmd.PrintOut method with appropriate parameter: acPages, acPrintAll or acSelection.
Close report and access itself if no longer needed.
-
Feb 8th, 2011, 02:45 PM
#3
Thread Starter
Addicted Member
Re: print button
Can you give me a sample of the coding please? And will this print the current record?
-
Feb 9th, 2011, 12:35 AM
#4
Thread Starter
Addicted Member
Re: print button
can some one help please, i need it for my project
-
Feb 9th, 2011, 02:28 AM
#5
Thread Starter
Addicted Member
-
Feb 9th, 2011, 03:18 AM
#6
Re: [RESOLVED] print button
How did you solve the problem?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Feb 9th, 2011, 04:04 AM
#7
Thread Starter
Addicted Member
Re: [RESOLVED] print button
i used this code:
Code:
Dim strDocName As String
Dim strWhere As String
strDocName = "MyReport"
strWhere = "[serial]=" & Me!txtserial
DoCmd.OpenReport strDocName, acPreview, , strWhere
-
Feb 9th, 2011, 08:12 AM
#8
Re: [RESOLVED] print button
That won't print report; like I said if you need to send it to printer then use DoCmd.PrintOut after opening report.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|