I have a form that I will be using for inspecting building sites and Im wanting to produce a single report each time I finish the inspection.
I have got it functioning but the report is only showing the data that has been previously saved, so no new data that I have entered into the form during the inspection is coming through to the report. But if I close out of the form, reopen and hit end inspection again all data will show in the report.
So in instead of writing a command that will close and reopen the form prior to producing the report, is there a way around this, what am I missing.
Code below.
'Saves record, calls other functions and closes the form
Private Sub Command43_Click()
Me.InspectionStatus.Value = "Completed"
DoCmd.Save
Call Savereport
Call PhotoTransfer
DoCmd.Close acForm, "PreApprovalReport"
End Sub
'creates. prints and saves the report
Function Savereport()
Dim strDocName As String
Dim strWhere As String
Dim user As String
Dim StrJobFile As String
Dim JobFile As String
Dim Filename As String
Filename = Me!InspectionType & " " & Me!ID
JobFile = Me![JobFile]
user = Environ("UserName")
Text53 = "C:\Users" & user & "\OneDrive\PCA work\Jobs" & JobFile & "" & Filename & ".pdf"
StrJobFile = Me![Text53]
strDocName = "143 inspection"
strWhere = "[ID]=" & Me!ID
DoCmd.Save
DoCmd.OpenReport strDocName, acPreview, , strWhere
DoCmd.OutputTo acOutputReport, "143 inspection", acFormatPDF, StrJobFile, , , , acExportQualityPrint
DoCmd.Close
End Function