D
DTW
Guys,
I know this has been discussed to death, but I still can't get it done.
I have a Master form with a subform. I have set a command button on the form
with the following code to hopefully print just one form the current form. I
cannot get it to work.
The name of the Master form = "Bill Back With Customers"
name of subform = "Bill Back" (Primary Key = "BillBackNumber " which is
autonumber)
name of report = "Bill Back Form Report"
I copied the form and constructed a report named Bill back Form Report. I
have a query set up to run the report. I have no filters in the report.
Here is the code behind the Subform "Bill Back" print button
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 = "[BillBackNumber] =" & Me.[BillBackNumber]
DoCmd.OpenReport "Bill Back Form Report", acViewPreview, , strWhere
End If
End Sub
I copied it from one of the threads on the forum and tried to set it to my
report and forms.
I am struggling with this.. now several nights.. I need to get it up and
running for work.
One question that is rolling around in my dumb mind is how to filter a query
in a report to have the report print the newest or highest autonumber (in my
case BillBackNumber)?
Thanks for any help...
DTW
I know this has been discussed to death, but I still can't get it done.
I have a Master form with a subform. I have set a command button on the form
with the following code to hopefully print just one form the current form. I
cannot get it to work.
The name of the Master form = "Bill Back With Customers"
name of subform = "Bill Back" (Primary Key = "BillBackNumber " which is
autonumber)
name of report = "Bill Back Form Report"
I copied the form and constructed a report named Bill back Form Report. I
have a query set up to run the report. I have no filters in the report.
Here is the code behind the Subform "Bill Back" print button
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 = "[BillBackNumber] =" & Me.[BillBackNumber]
DoCmd.OpenReport "Bill Back Form Report", acViewPreview, , strWhere
End If
End Sub
I copied it from one of the threads on the forum and tried to set it to my
report and forms.
I am struggling with this.. now several nights.. I need to get it up and
running for work.
One question that is rolling around in my dumb mind is how to filter a query
in a report to have the report print the newest or highest autonumber (in my
case BillBackNumber)?
Thanks for any help...
DTW