1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
| Code pour Form :
#Private Sub Command25_Click() ' Clean page
Doc.value = ""
Unit_Supplier.value = ""
Product.value = ""
Product_Description.value = ""
Qty.value = ""
Date.value = ""
name2.value = ""
Me.lirsign.Object.Ink.DeleteStrokes
Me.usersign.Object.Ink.DeleteStrokes
Form.Refresh
End Sub
Private Sub Command5_Click()
Dim objInk As MSINKAUTLib.InkPicture ' declaration Inkpicture
Dim byt() As Byte
Dim filen As String
filen = "\\xxx\LIR\xxx\Project_Access\signhere\sign.gif" ' Where is stock the sign
Set objInk = Me.usersign.Object
byt = objInk.Ink.Save(2)
Open filen For Binary As #1
Put #1, , byt
Close #1
filen = "\\xxx\LIR\xxx\Project_Access\signhere\signlir.gif"
Set objInk = Me.lirsign.Object
byt = objInk.Ink.Save(2)
Open filen For Binary As #2
Put #2, , byt
Close #2
DoCmd.OpenReport "Sign_1", acViewReport ' Open report in view report
End Sub
Private Sub Report_Open(Cancel As Integer)
deposit_sign_Click
Code reports :
Option Compare Database
Public Sub deposit_sign_Click()
Me.Sign.Picture = "\\xxx\LIR\xxx\Project_Access\signhere\sign.gif" ' take picture and deposit on report
Me.Sign.Visible = True
Me.signlir.Picture = "\\xxx\LIR\xxx\Project_Access\signhere\signlir.gif"
Me.signlir.Visible = True
End Sub
Function FileExist(FileFullPath As String) As Boolean
Dim value As Boolean
value = False
If Dir(FileFullPath) <> "" Then
value = True
End If
FileExist = value
End Function
Private Sub Command3_Click()
Dim fileName As String, fldrPath As String, filePath As String
Dim myDate As Date
Dim myDouble As Double
Dim sDate As String
Dim sTime As String
Dim sName As String
Dim sObject As String
Dim answer As Integer
myDouble = CDbl(Now()) ' take the current date and time, it is a double value
myDate = CDate(myDouble) 'extract the date from it
' MsgBox "The Double value " & myDouble & " represents the Date value " & myDate & "!"
sDate = Format(Date, "yyyymmdd")
sTime = Format(Time, "hhmmss") 'If you want a 1 minute interval on saving remove the ss from the strin (seconds)
' MsgBox sDate + " " + sTime
sObject = Unit_Supplier.value 'Retrieve information report
sName = name2.value
sName = Replace(sName, " ", "_")
fileName = sDate + "_" + sTime + "_ROE-F-PSS-0015I-NL_Uitgave_Documenten_" + sObject + "_" + sName 'filename for PDF file you can add more variables*
fldrPath = "\\xxx\LIR\Uitgave" 'folder path where pdf file will be saved *
filePath = fldrPath & "\" & fileName & ".pdf"
'check if file already exists
If FileExist(filePath) Then
answer = MsgBox(prompt:="PDF file already exists: " & vbNewLine & filePath & vbNewLine & vbNewLine & _
"Would you like to replace existing file?", Buttons:=vbYesNo, Title:="Existing PDF File")
If answer = vbNo Then Exit Sub
End If
On Error GoTo invalidFolderPath
DoCmd.OutputTo ObjectType:=acOutputReport, objectName:=Me.Name, outputformat:=acFormatPDF, outputFile:=filePath
'MsgBox prompt:="PDF File exported to: " & vbNewLine & filePath, buttons:=vbInformation, Title:="Report Exported as PDF"
Exit Sub
invalidFolderPath:
MsgBox prompt:="Error: Invalid folder path. Please update code.", Buttons:=vbCritical
End Sub
End Sub |
Partager