zen69
Messages postés584Date d'inscriptionjeudi 28 décembre 2006StatutMembreDernière intervention29 avril 2010
-
5 mai 2008 à 16:50
pitch95
Messages postés2Date d'inscriptionvendredi 10 septembre 2004StatutMembreDernière intervention13 août 2008
-
13 août 2008 à 17:39
Bonjour a tous,
J'ai presentement un problem avec le common dialog showprinter. Voila
j'essaye de choisir l'imprimante sur laquelle je veux imprimer sans
toute fois modifier l'imprimante par defaut. J'ai donc setter la
propriété PrinterDefault = False. Cepandant je ne sais pas comment recupérer l'imprimante selectionnée dans le common dialog... Quelqu'un peut m'aider svp?
zen69
Messages postés584Date d'inscriptionjeudi 28 décembre 2006StatutMembreDernière intervention29 avril 20101 5 mai 2008 à 17:33
Voici ce que j'ai jusqu'a maintenant:
Private Sub cmdPrint_Click()
Dim qty As Integer, i As Integer
Dim pFont As String
Dim pFontSize As Single
Dim pLines() As String
On Error GoTo Err_Handler
With adoTransfer
.CommandType = adCmdText
.RecordSource = "SELECT RTRIM(ITEMNMBR) AS ITEMNMBR, SUM(TRXQTY) AS TRXQTY FROM [MS-SERVER].M0851.dbo.IV10001 WHERE IVDOCNBR='TR" & txtTrNb.Text & "' GROUP BY RTRIM(ITEMNMBR) ORDER BY RTRIM(ITEMNMBR)"
.Refresh
With .Recordset
If .RecordCount = 0 Then
MsgBox "Transfert vide ou inexistant."
Exit Sub
End If
If Not .EOF And Not .BOF Then
.MoveFirst
Else
MsgBox "Transfert vide ou inexistant."
Exit Sub
End If
End With
End With
txtPrint.Text = m0851 & vbCrLf & "Date : " & Format(Now, "yyyy-mm-dd") & vbCrLf & lineSep & vbCrLf
With adoTransfer.Recordset
Do While Not .EOF And Not .BOF
DoEvents
txtPrint.Text = txtPrint.Text & .Fields("ITEMNMBR").Value & String$(2, vbTab) & .Fields("TRXQTY").Value & vbCrLf
qty = qty + .Fields("TRXQTY").Value
.MoveNext
Loop
End With
txtPrint.Text = txtPrint.Text & vbCrLf & lineSep & "Total : " & qty & " item(s)."
pFont = .font
pFontSize = .fontSize
.font = "ms sans serif"
.fontSize = 10
For i = LBound(pLines) To UBound(pLines)
Printer.Print pLines(i)
Next i
'.EndDoc
.font = pFont
.fontSize = pFontSize
End With
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, Err.Number
Exit Sub
End Sub