Object error

S

Stephen Haley

I am trying to use the Printlayout class that came with the Access
Developers Handbook (an absolute godsend) to uniformly set all my forms
print settings but keep getting an Run time error 13 "Type missmatch" in the
code on the line set pl.object=frm.
I have traced the error to the fact that the form(s) in question doesnt have
a Module - what have I done wrong or is this normal and access vba isnt
actualy looking at the form properties but at the mirrored properties in the
VBE (Codeproject).

The code block in question is

Dim FrmObj As AccessObject
Dim Frm As Access.Form
Dim pl As PrintLayout
Dim strFrmName As String
Set pl = New PrintLayout
Debug.Print "Form Name", , "Left", "Right", "Top", "Bottom", "Width",
"Height", "Orientation"
For Each FrmObj In Application.CurrentProject.AllForms
strFrmName = FrmObj.Name
DoCmd.OpenForm strFrmName, acDesign
Set Frm = Application.Forms(strfname).Form
Set pl.Object = Frm
............................

DoCmd.Close acForm, strFrmName, acSaveNo
Next FrmObj

and I am using Access 2003

sorry for the frequent posts but it has been a while since I have done
serious coding and this project was probably not the best to get going on
again - clients are being very demanding and code is already 50 pages!

Thanks for all the help

rgds
Stephen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top