I recently upgraded computers and, as a result, upgraded my version of Access. With catastrophic results. The new version produces reports that are missing large amounts of data and have If-Then code producing absurd results. In trouble-shooting the issues I quickly found that the unbound text boxes that I've been using as controls for the rest of the form are being reset to Null when switching to Print Preview.
To simplify the problem I built a shiny, new database to avoid any version incompatibility or migration issues. I then made a very basic form that has two text boxes.
Text Box 1 is unbound and is filled by an On Load subroutine that reads:
Private Sub Report_Load()
Me.Text0 = "Yay! Data!"
End Sub
Text Box 2 checks to see if the value of Text Box 1 is Null.
=IIf(IsNull([Text0]),"Bugger, where did it go?","All good!")
When the report is loaded all looks good.
When the view is switched to Print Preview Text Box 1 goes blank and Text Box 2 indicates that the value in Text Box 1 is now Null.
After switching back to Report view, Text Box 1 remains Null. The data is gone and not coming back.
Interestingly, if you open the report in Print Preview mode it all looks fine. I'm guessing that there's a requery or something similar triggered by switching views.
I've tried looking this up but results have been unhelpful answers from a decade or more ago. Can anybody kindly explain to me why MS Access Print Preview insists on eating/dropping/purging my data? And how to get it to quit being pesky.
Thanks!