When i try to print out a report it keeps printing out multiple copies. when you click the form it is supposed to print out 1 copy based on the request. so i have an if statement to test the type if its a request print one if it isn't a request print 2 copies. Not sure what is wrong with the code
Private Sub Command353_Click() On Error Resume Next
Dim aVariable
Dim strQ, strCheck As String
Me.RecordsetClone.MoveLast
Me.Recordset.MoveFirst
For i = 1 To Me.RecordsetClone.RecordCount
Me.Recordset.MoveNext
'DoCmd.PrintOut acSelection
If Me.System = "3" Then
strQ = "q_Chosen3"
strCheck = "Update3Locs"
ElseIf Me.System = "Operation" Then
strQ = "q_ChosenOperation"
strCheck = "UpdateOperationLocs"
ElseIf Me.System = "Market" Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "q_ChosenMarket"
'DoCmd.OpenQuery "UpdateMarketLocs"
DoCmd.SetWarnings True
'strQ = "q_ChosenMarket"
'strCheck = "UpdateMarketLocs"
ElseIf Me.System = "2" Then
strQ = "q_2"
strCheck = "Update2Locs"
Else
strQ = "q_Chosen1"
strCheck = "Update1Locs"
End If
aVariable = DLookup("[Item Number]", strQ)
If IsNull(aVariable) Then
DoCmd.SetWarnings False
DoCmd.OpenQuery strCheck
DoCmd.SetWarnings True
End If
Call recordLocations
DoCmd.OpenQuery "Apnd_Log"
DoCmd.OpenReport "rptTicket", acNormal
DoCmd.PrintOut acPages, 1, 1, , 1
' If [Type] = "E-Mail" Then ' DoCmd.PrintOut , 1, 1, , 1
' ElseIf [Type] = "Request" Then ' DoCmd.PrintOut , 1, 1, , 1 ' Else ' DoCmd.PrintOut , 1, 1, , 1 ' End If
If Err.Number = 2105 Then
MsgBox "End of the Requests"
Err.clear
DoCmd.SetWarnings False
DoCmd.OpenQuery "q_UpdateRequestsPick"
DoCmd.Close acForm, "Search Ticket"
DoCmd.OpenQuery "delW3Checks"
DoCmd.OpenQuery "delOperationChecks"
DoCmd.OpenQuery "del1Checks"
DoCmd.OpenQuery "delMarketChecks"
DoCmd.SetWarnings True
Call Forms("f_BDMain").Command26_Click
End If
Next i
'DoCmd.Close acForm, "Search Ticket"
'Call Forms("f_BDMain").Command26_Click
End Sub
Aucun commentaire:
Enregistrer un commentaire