D
datahunter
I found this code that sounds exactaly like wat i need but i dont undersatnd
the code... VBA is new to me.. the code i found is:
(Q) I'm trying to print out only the current record from my form in a report
but each time all the records print out. How can I print only one record
using a report?
(A) Use the OpenReport's Where condition to specify your record. For
example, the following code placed behind a command button on the form would
use the RunID control on the form to restrict the Report to only one record.
'******************** Code Start ************************
Dim strDocName As String
Dim strWhere As String
strDocName = "rptSomeReport"
strWhere = "[RunID]=" & me!RunID
DoCmd.OpenReport strDocName, acPreview, , strWhere
'******************** Code End ************************
I tryed this but i am not sure what to change so it will work in my
database. My table name is MainTable the report name is Contract and my prime
key is CustomerId and my form that the print button would be in is named
MainForm... I know vary original names lol.. Thanks to everyone for helping
the less educated!
the code... VBA is new to me.. the code i found is:
(Q) I'm trying to print out only the current record from my form in a report
but each time all the records print out. How can I print only one record
using a report?
(A) Use the OpenReport's Where condition to specify your record. For
example, the following code placed behind a command button on the form would
use the RunID control on the form to restrict the Report to only one record.
'******************** Code Start ************************
Dim strDocName As String
Dim strWhere As String
strDocName = "rptSomeReport"
strWhere = "[RunID]=" & me!RunID
DoCmd.OpenReport strDocName, acPreview, , strWhere
'******************** Code End ************************
I tryed this but i am not sure what to change so it will work in my
database. My table name is MainTable the report name is Contract and my prime
key is CustomerId and my form that the print button would be in is named
MainForm... I know vary original names lol.. Thanks to everyone for helping
the less educated!