User-Defined type not defined

hello

I use ACCESS 2000.  I'd like to run the following code borrowed from one of 
the Access user sites, but compiling fails at the Dim statement.  
("User-defined type not defined")

Private Sub ListAvailPrinters()
    Dim prn As Printer
    For Each prn In Application.Printers
        Debug.Print prn.DeviceName & " on " & prn.Port
    Next prn
End Sub

I suspect a Reference Library is not installed, but I'm not sure which one I 
need.  I currently have the following Reference Libraries:

   Visual Basic For Applications
   Microsoft Access 9.0 Object Library
   Microsof DAO 3.6 Object Library
   OLE Automation

Any suggestions?
Much thanks
-- 
cinnie
0
Utf
3/10/2010 4:42:01 PM
access.formscoding 7493 articles. 0 followers. Follow

6 Replies
887 Views

Similar Articles

[PageSpeed] 14

Unfortunately the Printer object was not untroduced until A2002.  You will 
need to do this the hard way... check http://mvps.org/access/API for 
PrtDevMode code...

good luck!

-- 
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."  
-Thomas Edison (1847-1931) 



"cinnie" wrote:

> hello
> 
> I use ACCESS 2000.  I'd like to run the following code borrowed from one of 
> the Access user sites, but compiling fails at the Dim statement.  
> ("User-defined type not defined")
> 
> Private Sub ListAvailPrinters()
>     Dim prn As Printer
>     For Each prn In Application.Printers
>         Debug.Print prn.DeviceName & " on " & prn.Port
>     Next prn
> End Sub
> 
> I suspect a Reference Library is not installed, but I'm not sure which one I 
> need.  I currently have the following Reference Libraries:
> 
>    Visual Basic For Applications
>    Microsoft Access 9.0 Object Library
>    Microsof DAO 3.6 Object Library
>    OLE Automation
> 
> Any suggestions?
> Much thanks
> -- 
> cinnie
0
Utf
3/10/2010 4:54:01 PM
Thanks Jack - guess it's time for me to upgrade!
-- 
cinnie


"Jack Leach" wrote:

> Unfortunately the Printer object was not untroduced until A2002.  You will 
> need to do this the hard way... check http://mvps.org/access/API for 
> PrtDevMode code...
> 
> good luck!
> 
> -- 
> Jack Leach
> www.tristatemachine.com
> 
> "I haven''t failed, I''ve found ten thousand ways that don''t work."  
> -Thomas Edison (1847-1931) 
> 
> 
> 
> "cinnie" wrote:
> 
> > hello
> > 
> > I use ACCESS 2000.  I'd like to run the following code borrowed from one of 
> > the Access user sites, but compiling fails at the Dim statement.  
> > ("User-defined type not defined")
> > 
> > Private Sub ListAvailPrinters()
> >     Dim prn As Printer
> >     For Each prn In Application.Printers
> >         Debug.Print prn.DeviceName & " on " & prn.Port
> >     Next prn
> > End Sub
> > 
> > I suspect a Reference Library is not installed, but I'm not sure which one I 
> > need.  I currently have the following Reference Libraries:
> > 
> >    Visual Basic For Applications
> >    Microsoft Access 9.0 Object Library
> >    Microsof DAO 3.6 Object Library
> >    OLE Automation
> > 
> > Any suggestions?
> > Much thanks
> > -- 
> > cinnie
0
Utf
3/10/2010 5:08:01 PM
That may be a much easier solution!  I've never used it, but from what a 
gather the PrtDevMode functions are quite a pain...

-- 
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."  
-Thomas Edison (1847-1931) 



"cinnie" wrote:

> Thanks Jack - guess it's time for me to upgrade!
> -- 
> cinnie
> 
> 
> "Jack Leach" wrote:
> 
> > Unfortunately the Printer object was not untroduced until A2002.  You will 
> > need to do this the hard way... check http://mvps.org/access/API for 
> > PrtDevMode code...
> > 
> > good luck!
> > 
> > -- 
> > Jack Leach
> > www.tristatemachine.com
> > 
> > "I haven''t failed, I''ve found ten thousand ways that don''t work."  
> > -Thomas Edison (1847-1931) 
> > 
> > 
> > 
> > "cinnie" wrote:
> > 
> > > hello
> > > 
> > > I use ACCESS 2000.  I'd like to run the following code borrowed from one of 
> > > the Access user sites, but compiling fails at the Dim statement.  
> > > ("User-defined type not defined")
> > > 
> > > Private Sub ListAvailPrinters()
> > >     Dim prn As Printer
> > >     For Each prn In Application.Printers
> > >         Debug.Print prn.DeviceName & " on " & prn.Port
> > >     Next prn
> > > End Sub
> > > 
> > > I suspect a Reference Library is not installed, but I'm not sure which one I 
> > > need.  I currently have the following Reference Libraries:
> > > 
> > >    Visual Basic For Applications
> > >    Microsoft Access 9.0 Object Library
> > >    Microsof DAO 3.6 Object Library
> > >    OLE Automation
> > > 
> > > Any suggestions?
> > > Much thanks
> > > -- 
> > > cinnie
0
Utf
3/10/2010 5:50:02 PM
hi Cinnie,

On 10.03.2010 17:42, cinnie wrote:
> I use ACCESS 2000.  I'd like to run the following code borrowed from one of
> the Access user sites, but compiling fails at the Dim statement.
> ("User-defined type not defined")
>
>      Dim prn As Printer
 >
> I suspect a Reference Library is not installed, but I'm not sure which one I
> need.
No, your doomed. Oops, too theatrically.)

The Printer object was introduced to Access 2002, so it is not available 
in Access 2000.

So the question is: What exactly do you like to do?



mfG
--> stefan <--
0
Stefan
3/10/2010 5:54:20 PM
"Stefan Hoffmann" <ste5an@ste5an.de> wrote in message 
news:OVNa2qHwKHA.3564@TK2MSFTNGP05.phx.gbl...
> hi Cinnie,
>
> On 10.03.2010 17:42, cinnie wrote:
>> I use ACCESS 2000.  I'd like to run the following code borrowed from one 
>> of
>> the Access user sites, but compiling fails at the Dim statement.
>> ("User-defined type not defined")
>>
>>      Dim prn As Printer
> >
>> I suspect a Reference Library is not installed, but I'm not sure which 
>> one I
>> need.
> No, your doomed. Oops, too theatrically.)
>
> The Printer object was introduced to Access 2002, so it is not available 
> in Access 2000.
>
> So the question is: What exactly do you like to do?
>
>
>
> mfG
> --> stefan <--


Hello mfG
I am experiencing the same problem with a Dim statement for a new ADODB 
connection
I am using Access 2002
Please see my thread called
"adding to table from drop down box"
Any thoughts?

-- 
Regards,
Richard Harison 


0
LightByrd
3/10/2010 10:00:07 PM
Hi Stefan.  I'm actually not trying to do anything other than familiarize 
myself with VBA.  Thanks for the advice.
-- 
cinnie


"Stefan Hoffmann" wrote:

> hi Cinnie,
> 
> On 10.03.2010 17:42, cinnie wrote:
> > I use ACCESS 2000.  I'd like to run the following code borrowed from one of
> > the Access user sites, but compiling fails at the Dim statement.
> > ("User-defined type not defined")
> >
> >      Dim prn As Printer
>  >
> > I suspect a Reference Library is not installed, but I'm not sure which one I
> > need.
> No, your doomed. Oops, too theatrically.)
> 
> The Printer object was introduced to Access 2002, so it is not available 
> in Access 2000.
> 
> So the question is: What exactly do you like to do?
> 
> 
> 
> mfG
> --> stefan <--
> .
> 
0
Utf
3/10/2010 10:37:01 PM
Reply:

Similar Artilces: