Blank form when printing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a form from multiple tables and when I try
to print it I get a blank screen. Anyone know why this is
happening?
 
I have created a form from multiple tables and when I try
to print it I get a blank screen. Anyone know why this is
happening?

Well... Forms are for onscreen use and are not designed or adapted for
printing. Create a Report to print.

You'll get a blank form (on screen and on paper) if the form's
Recordsource is not updateable and returns no records.
 
That is right. (John being an MVP he should know.) Forms are NOT for
printing-out; many many times I see entry-level Access users (hey, we all
used to be that ourselves) practically INSIST on printing the form itself.
Even when it does print, it uses way too muck ink--painting the whole
background black and using tons of ink that way--and it looks messy to boot.

So, yes--create a report based on the same table/query your form is based
on, and use that to print.

If you wish to automate the process--which is, create a button which you can
click on the form and print that particular record being displayed--then on
your form (in DESIGN view obviously), create a command button, name it
something like 'cmdPrint', and put the following code (which you will need
to modify based on variables on your form) in the button's "on click" event
procedure:

Private Sub cmdPrint_Click()
Dim sSQL As String
'Save the record so it is available to print even if it was just added right
now
DoCmd.RunCommand acCmdSaveRecord
sSQL = "[autoid]=" & Me.autoid
DoCmd.OpenReport "name_of_your_report", acViewPreview, , sSQL
End Sub

This will only work if you have an "autonumber" type of field--which you
should--and in this case if it's named "autoid" (that's one of the variables
which you will need to change depending on the names of the controls on your
form etc).

LRH
http://www.dbases.net/knowledge_base
 
Back
Top