Wrox Programmer Forums
|
BOOK: Beginning Access VBA
This is the forum to discuss the Wrox book Beginning Access 2002 VBA by Robert Smith, Dave Sussman, Ian Blackburn, John Colby, Mark Horner, Martin Reid, Paul Turley, Helmut Watson; ISBN: 9780764544026
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 10th, 2004, 11:52 AM
Authorized User
 
Join Date: Jul 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginning Access 2002 VBA Chapter 5

On page 197 of Chapter 5, Try It Out, the first instruction is to create a new subroutine called FormFonts, like so:

Public Sub FormFonts(strFont As String)

Dim frmCurrent As Form
  Dim ctlControl As Control

  For Each frmCurrent In Forms
    For Each ctlControl In frmCurrent.Controls
      ctlControl.FontName = strFont
    Next
  Next
End Sub

Next, we are told to use the immediate window to run the code. The authors indicate that running the code should generate the following error message: "Run-time error '436' Object doesn't support this property or method" and then explain why this is so. Despite the error, however, text of the form's text boxes and labels should reflect change up to the control that caused the error.

When I ran this code, I received a compile error, "Sub or Function not defined." Can someone tell me what the problem may be?

Thanks.



 
Old August 16th, 2004, 01:49 PM
Authorized User
 
Join Date: Oct 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What a coincidence, I too am having that very same problem. I think it has something to do with "ctlControl.Font = strFont" as Font does not appear in the drop down menu after after Control. I have looked in References and cannot see any reference to it in DAO (which I believe is what we are supposed to be using, or am i wrong?), but I am lost.

 
Old August 16th, 2004, 02:20 PM
Authorized User
 
Join Date: Oct 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually, I have rewritten the code and hey presto....it works. Don't ask me how, but it does

tony






Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning Access 2002 VBA Chapter 3 Olivia54 BOOK: Beginning Access VBA 3 January 24th, 2006 12:11 PM
Beginning Access 2002 VBA Code pajiyar BOOK: Beginning Access VBA 0 July 12th, 2004 08:04 AM
Beginning Access VBA 2002 Database File sristm BOOK: Beginning Access VBA 0 March 31st, 2004 12:08 AM
Does anyone have the Beginning Access 2002 VBA CD? sristm Access VBA 0 March 21st, 2004 04:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.