Originally Posted by
Welshgasman
I have always set the filter to "" as well?
lol yeah I saw that post online somewhere. I think it was:
Me.Filter = ""
Me.FilterOn = False
That didn't work either. I have come up with an unsatisfying solution for now. It closes the form then reopens it and then all the records load. The thing I don't like about it is that it makes the form flash because its closing and reopening so it looks horrible and also when it reopens, I don't know how to open it back up to the record that it was on right before it closed. So the right now it just reopens to a new record. The code looks like this:
Code:
If MsgBox("Export Record To PDF?", vbYesNo, "Export") = vbYes Then
Dim FileName As String
Dim FilePath As String
FileName = "Counter_Log_" & Me.txtRefNum
FilePath = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "" & FileName & ".pdf"
Me.Filter = "[Ref Num] = " & Me.[txtRefNum]
Me.FilterOn = True
DoCmd.OutputTo acOutputForm, "Counter Log", acFormatPDF, FilePath
MsgBox "PDF File Was Exported As (Counter_Log_Ref#.pdf) To Your Desktop", _
vbInformation, "Notification"
Me.txtCustNum.SetFocus
DoCmd.Close
DoCmd.OpenForm "Counter Log"
DoCmd.GoToRecord , , acNewRec
Else
Me.txtCustNum.SetFocus
End If