A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Event Procedure



 
 
Thread Tools Display Modes
  #1  
Old March 25th, 2005, 09:45 PM
Antonio
external usenet poster
 
Posts: n/a
Default Event Procedure

Hello group,

Can anyone tell me what's wrong with Event. I'm getting the following erro
message Compil error: User-defined type not defined. I have Access 2000

Thanks in advance


Private Sub Form_Open(Cancel As Integer)

' Variable to hold the default printer index.
Dim strDefaultPrinter As String

' Variable to hold the printer object.
Dim prt As Printer

' Variable to hold the report object while cycling
' through the AllReports collection.
Dim accObj As AccessObject

' Fill the printer list.
' Make sure the RowSource is empty.
Me!cmbPrinter.RowSource = ""
Me!lbxSelectReport.RowSource = ""

' Cycle through the printers installed on the machine and add them to the
combo box.
For Each prt In Application.Printers
' Use the new AddItem method to add the printer name to the combo box.
Me!cmbPrinter.AddItem prt.DeviceName
Next

' Remember the default printer.
strDefaultPrinter = Application.Printer.DeviceName

' Set the combo box to the default printer.
Me!cmbPrinter = strDefaultPrinter
Me!cmbPaperSize = 1

' Fill the report list.
For Each accObj In CurrentProject.AllReports
Me!lbxSelectReport.AddItem accObj.Name
Next

' Set the list box to the first report.
Me!lbxSelectReport.SetFocus
Me!lbxSelectReport.ListIndex = 0

End Sub

  #2  
Old March 25th, 2005, 09:53 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"Antonio" wrote in message

Hello group,

Can anyone tell me what's wrong with Event. I'm getting the
following erro message Compil error: User-defined type not defined. I
have Access 2000

Thanks in advance


Private Sub Form_Open(Cancel As Integer)

' Variable to hold the default printer index.
Dim strDefaultPrinter As String

' Variable to hold the printer object.
Dim prt As Printer

' Variable to hold the report object while cycling
' through the AllReports collection.
Dim accObj As AccessObject

' Fill the printer list.
' Make sure the RowSource is empty.
Me!cmbPrinter.RowSource = ""
Me!lbxSelectReport.RowSource = ""

' Cycle through the printers installed on the machine and add them to
the combo box.
For Each prt In Application.Printers
' Use the new AddItem method to add the printer name to the combo box.
Me!cmbPrinter.AddItem prt.DeviceName
Next

' Remember the default printer.
strDefaultPrinter = Application.Printer.DeviceName

' Set the combo box to the default printer.
Me!cmbPrinter = strDefaultPrinter
Me!cmbPaperSize = 1

' Fill the report list.
For Each accObj In CurrentProject.AllReports
Me!lbxSelectReport.AddItem accObj.Name
Next

' Set the list box to the first report.
Me!lbxSelectReport.SetFocus
Me!lbxSelectReport.ListIndex = 0

End Sub


I don't think Access 2000 has the Printers collection and Printer
object. I believe they were introduced wth Access 2002.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EXCEL 2002: How do I user/simulate a Timer event in Excel form JohnF Worksheet Functions 6 September 23rd, 2004 04:56 PM
event procedure rclark General Discussion 2 September 3rd, 2004 02:41 PM
EXCEL 2002: How do I user/simulate a Timer event in Excel form JohnF General Discussion 1 August 24th, 2004 05:56 AM
Need help with Access decision aualias General Discussion 23 June 21st, 2004 02:04 AM


All times are GMT +1. The time now is 04:38 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.