How do I print one page of a report via a control?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I created a database with many records and would like to just print one page
from the report. In addition, the interface that I am using to edit records
is via a data access page and would like to have the controls for printing
the one page of the report at the data access page.

The reason for using the data access page is that this way I have a webpage
that can be seen by many from their PCs.

Thanks for any suggestions on how to accomplish this.
 
Here is the code for a button on a form. I assume a DAP would work the
same, but I have never been able to get a DAP to work...



Private Sub cmdPrint_Click() 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 = "[ID] = " & Me.[ID] DoCmd.OpenReport
"MyReport", acViewPreview, , strWhere End IfEnd Sub Notes:If your primary
key is a Text type field (not a Number type field), you need extra quotes:
strWhere = "[ID] = """ & Me.[ID] & """" If you want the report to print
without preview, replace acViewPreview with acViewNormal. "Joe Leon"
 
Let's try that again...


Private Sub cmdPrint_Click()

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 = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes:

If your primary key is a Text type field (not a Number type field), you need
extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.








Rick B said:
Here is the code for a button on a form. I assume a DAP would work the
same, but I have never been able to get a DAP to work...



Private Sub cmdPrint_Click() 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 = "[ID] = " & Me.[ID] DoCmd.OpenReport
"MyReport", acViewPreview, , strWhere End IfEnd Sub Notes:If your primary
key is a Text type field (not a Number type field), you need extra quotes:
strWhere = "[ID] = """ & Me.[ID] & """" If you want the report to print
without preview, replace acViewPreview with acViewNormal. "Joe Leon"
I created a database with many records and would like to just print one page
from the report. In addition, the interface that I am using to edit records
is via a data access page and would like to have the controls for printing
the one page of the report at the data access page.

The reason for using the data access page is that this way I have a webpage
that can be seen by many from their PCs.

Thanks for any suggestions on how to accomplish this.
 
Rick,
Thanks! This worked well with the form button. I would like to somehow
figure out a way to make it work with a DAP. When I opened the DAP source, it
is in HTML. I'm not familiar with HTML coding so it's going to be a struggle.


For now the form works great. Rick, I was reading a book on Access 2002 and
in it it says that I can take a form and convert it to HTML. Is this only a
feature of Acess 2002? Is there a way to do this with Access 2000?

Thanks!
Joe...

Rick B said:
Let's try that again...


Private Sub cmdPrint_Click()

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 = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes:

If your primary key is a Text type field (not a Number type field), you need
extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.








Rick B said:
Here is the code for a button on a form. I assume a DAP would work the
same, but I have never been able to get a DAP to work...



Private Sub cmdPrint_Click() 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 = "[ID] = " & Me.[ID] DoCmd.OpenReport
"MyReport", acViewPreview, , strWhere End IfEnd Sub Notes:If your primary
key is a Text type field (not a Number type field), you need extra quotes:
strWhere = "[ID] = """ & Me.[ID] & """" If you want the report to print
without preview, replace acViewPreview with acViewNormal. "Joe Leon"
I created a database with many records and would like to just print one page
from the report. In addition, the interface that I am using to edit records
is via a data access page and would like to have the controls for printing
the one page of the report at the data access page.

The reason for using the data access page is that this way I have a webpage
that can be seen by many from their PCs.

Thanks for any suggestions on how to accomplish this.
 
Sorry, I have had no luck with data access pages. hopefully someone with
more knowledge will see your post. You may want to reports a new message
since this is a new topic.

Good Luck. Glad I could help with the other issue.

Rick B


Joe Leon said:
Rick,
Thanks! This worked well with the form button. I would like to somehow
figure out a way to make it work with a DAP. When I opened the DAP source, it
is in HTML. I'm not familiar with HTML coding so it's going to be a struggle.


For now the form works great. Rick, I was reading a book on Access 2002 and
in it it says that I can take a form and convert it to HTML. Is this only a
feature of Acess 2002? Is there a way to do this with Access 2000?

Thanks!
Joe...

Rick B said:
Let's try that again...


Private Sub cmdPrint_Click()

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 = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes:

If your primary key is a Text type field (not a Number type field), you need
extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.








Rick B said:
Here is the code for a button on a form. I assume a DAP would work the
same, but I have never been able to get a DAP to work...



Private Sub cmdPrint_Click() 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 = "[ID] = " & Me.[ID] DoCmd.OpenReport
"MyReport", acViewPreview, , strWhere End IfEnd Sub Notes:If your primary
key is a Text type field (not a Number type field), you need extra quotes:
strWhere = "[ID] = """ & Me.[ID] & """" If you want the report to print
without preview, replace acViewPreview with acViewNormal. "Joe Leon"
I created a database with many records and would like to just print one
page
from the report. In addition, the interface that I am using to edit
records
is via a data access page and would like to have the controls for printing
the one page of the report at the data access page.

The reason for using the data access page is that this way I have a
webpage
that can be seen by many from their PCs.

Thanks for any suggestions on how to accomplish this.
 
Joe, I have a book, Access 2000 Developer's Handbook Vol 2, in it there is
reference to a wizard that will convert Forms to DAP, it is written by
Michael Kaplan from TSI. However, it blows up with a type mismatch error
message and quits. I have tried to email Mr. Kaplan, but he has not
responded. You can get the wizard at http://www.trigeminal.com , look for
TSI Form/Report to Data Access Page Wizard.

Joe Leon said:
Rick,
Thanks! This worked well with the form button. I would like to somehow
figure out a way to make it work with a DAP. When I opened the DAP source, it
is in HTML. I'm not familiar with HTML coding so it's going to be a struggle.


For now the form works great. Rick, I was reading a book on Access 2002 and
in it it says that I can take a form and convert it to HTML. Is this only a
feature of Acess 2002? Is there a way to do this with Access 2000?

Thanks!
Joe...

Rick B said:
Let's try that again...


Private Sub cmdPrint_Click()

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 = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes:

If your primary key is a Text type field (not a Number type field), you need
extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.








Rick B said:
Here is the code for a button on a form. I assume a DAP would work the
same, but I have never been able to get a DAP to work...



Private Sub cmdPrint_Click() 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 = "[ID] = " & Me.[ID] DoCmd.OpenReport
"MyReport", acViewPreview, , strWhere End IfEnd Sub Notes:If your primary
key is a Text type field (not a Number type field), you need extra quotes:
strWhere = "[ID] = """ & Me.[ID] & """" If you want the report to print
without preview, replace acViewPreview with acViewNormal. "Joe Leon"
I created a database with many records and would like to just print one
page
from the report. In addition, the interface that I am using to edit
records
is via a data access page and would like to have the controls for printing
the one page of the report at the data access page.

The reason for using the data access page is that this way I have a
webpage
that can be seen by many from their PCs.

Thanks for any suggestions on how to accomplish this.
 
Back
Top