R
richard
Allen
I have used the database you suggested the other day to save and print a
batch at a later date
I am having a problem with the strwhere part of the print batch code in the
database.
My table can have multiple items within the same batch so as part of the
list box I have used a duplicates query to hide any multiples. I am now
struggling to get the BatchNumber to be used in the selection part of the
code for PrintBatch_click.
The SQL for the query on the list box is below
SELECT First(tblnapswork.BatchNumber) AS BatchNumberField,
First(tblnapswork.BatchDate) AS BatchDateField, Count(tblnapswork.BatchDate)
AS NumberOfDups, Count(tblnapswork.BatchNumber) AS CountOfBatchNumber
FROM tblnapswork
GROUP BY tblnapswork.BatchDate, tblnapswork.BatchNumber
HAVING (((Count(tblnapswork.BatchDate))>1) AND
((Count(tblnapswork.BatchNumber))>1))
ORDER BY First(tblnapswork.BatchNumber) DESC;
The code for running the report based on the batch is below
Private Sub cmdPrintBatch_Click()
On Error GoTo Err_handler
Dim strwhere As String
Const strcDoc = "rptDataSheetBatchReprint"
If IsNull(Me.List15) Then
MsgBox "Select a batch to print."
Else
If CurrentProject.AllReports(strcDoc).IsLoaded Then
DoCmd.Close acReport, strcDoc
End If
strwhere = "BatchNumber=" & Me.List15
DoCmd.OpenReport strcDoc, acViewPreview, , strwhere
End If
Exit_handler:
Exit Sub
Err_handler:
MsgBox "Error " & Err.Number & ":" & Err.description, vbExclamation,
".cmdPrintBatch_click"
Resume Exit_handler
End Sub
any help would be appreciated
I have used the database you suggested the other day to save and print a
batch at a later date
I am having a problem with the strwhere part of the print batch code in the
database.
My table can have multiple items within the same batch so as part of the
list box I have used a duplicates query to hide any multiples. I am now
struggling to get the BatchNumber to be used in the selection part of the
code for PrintBatch_click.
The SQL for the query on the list box is below
SELECT First(tblnapswork.BatchNumber) AS BatchNumberField,
First(tblnapswork.BatchDate) AS BatchDateField, Count(tblnapswork.BatchDate)
AS NumberOfDups, Count(tblnapswork.BatchNumber) AS CountOfBatchNumber
FROM tblnapswork
GROUP BY tblnapswork.BatchDate, tblnapswork.BatchNumber
HAVING (((Count(tblnapswork.BatchDate))>1) AND
((Count(tblnapswork.BatchNumber))>1))
ORDER BY First(tblnapswork.BatchNumber) DESC;
The code for running the report based on the batch is below
Private Sub cmdPrintBatch_Click()
On Error GoTo Err_handler
Dim strwhere As String
Const strcDoc = "rptDataSheetBatchReprint"
If IsNull(Me.List15) Then
MsgBox "Select a batch to print."
Else
If CurrentProject.AllReports(strcDoc).IsLoaded Then
DoCmd.Close acReport, strcDoc
End If
strwhere = "BatchNumber=" & Me.List15
DoCmd.OpenReport strcDoc, acViewPreview, , strwhere
End If
Exit_handler:
Exit Sub
Err_handler:
MsgBox "Error " & Err.Number & ":" & Err.description, vbExclamation,
".cmdPrintBatch_click"
Resume Exit_handler
End Sub
any help would be appreciated