Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 10th, 2004, 01:01 PM
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sub or Function Not Defined

Hi All,
Thanks for your gracious welcome, Bob. I'm doing an exercise in which the authors told me to create a new subroutine called FormFonts, like so:

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 this 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 is suppose to cause the error to occur.

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 much.


Reply With Quote
  #2 (permalink)  
Old July 10th, 2004, 01:26 PM
Registered User
 
Join Date: Jul 2004
Location: , , Belgium.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Olivia,

I think that you must put a breakpoint in your code and start your form and then you can call the sub in the immediate window.

Excuse my english i leave in Belgium and spoke french.

Hello2lu
Reply With Quote
  #3 (permalink)  
Old July 10th, 2004, 01:36 PM
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your response, Hello2lu.

Unfortunately, adding the break point didn't resolve the problem.

But, again, thanks for your response. Also, you can communicate in at least two languages, I can only communicate in English. In my humble opinion, no apologies for your English are necessary.:)

Reply With Quote
  #4 (permalink)  
Old July 10th, 2004, 01:48 PM
Registered User
 
Join Date: Jul 2004
Location: , , Belgium.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Olivia,

when you call your sub in the immediate window, is your form in 'create mode' or 'form mode' ?

I try your exercise and when i call the sub in 'creation mode' i receive the same message (procedure or sub not defined) and when i start in 'form mode' and reach the breakpoint (placed in form_load), if i call the sub, i receive the message that your expect (Object doesn't support this property or method).

Hello2lu

Reply With Quote
  #5 (permalink)  
Old July 10th, 2004, 02:56 PM
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, again Hello2lu!

While problem solving (after I had posted my question), I recreated the routine and inadvertently made it private. Thus, your tip about form vs design view initially didn't work.

After realizing what I had done and correcting the problem, your form vs design view tip has resolved my problem.

Have a great day!:)

Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
User Defined function in XSL1.0 elayaraja.s XML 1 July 22nd, 2008 04:24 AM
Go for View or User Defined function vinod_yadav1919 SQL Server 2000 1 December 12th, 2007 05:18 AM
Help : compile error : sub or function not defined Specialist VB How-To 2 June 20th, 2007 05:34 AM
error function not defined Dj Kat Ajax 6 March 6th, 2006 12:02 PM
User Defined Function niravp SQL Server 2000 7 November 29th, 2004 02:18 PM



All times are GMT -4. The time now is 03:02 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.