473,505 Members | 16,332 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting"MS Access can't find the object...." error

3 New Member
Hi--I am trying to get an Access database to print labels NOT starting on the first line of labels (to use up partially-used sheets). I was directed to this MS Knowledge Base article:
http://support.microsoft.com/kb/299024

I am not new to Access but am very much a beginner with VBA. I pasted the following code from the KB article in a Standard module in my database:
Expand|Select|Wrap|Line Numbers
  1. '*********************************************************
  2.    'Declarations section of the module.
  3. '**********************************************************
  4.  
  5. Option Compare Database
  6. Option Explicit
  7.  
  8. Dim LabelBlanks&
  9. Dim LabelCopies&
  10. Dim BlankCount&
  11. Dim CopyCount&
  12.  
  13. '==========================================================
  14.    ' The following function will cause an input box to
  15.    ' display when the report is run that prompts the user
  16.    ' for the number of used labels to skip and how many
  17.    ' copies of each label should be printed.
  18. '===========================================================
  19.  
  20. Function LabelSetup ()
  21.    LabelBlanks& = Val(InputBox$("Enter Number of blank labels to skip"))
  22.    LabelCopies& = Val(InputBox$("Enter Number of Copies to Print"))
  23.    If LabelBlanks& < 0 Then LabelBlanks& = 0
  24.    If LabelCopies& < 1 Then LabelCopies& = 1
  25. End Function
  26.  
  27. (There are other functions in the module as well)
  28.  
As per the instructions in the KB article, I put
=LabelSetup()
in the OnOpen property of my Labels report to call the function.

When I try to print the report (or see it in Print view), I get the error "Microsoft Access cannot find the object '=LabelSetup().' If '=LabelSetup()' is a new macro or macro group, make sure you have saved it and that you have typed its name correctly."

Here is what I have tried so far:
(1) Double- and triple-checked that the function in the module and the function call are spelled exactly the same
(2) Compacted and repaired the database
(3) Deleted, repasted and recompiled the Standard code module

and I still get the error.

These were all things I did through suggestions from an expert on another forum.

Any other ideas as to why this frustrating thing is happening?

Thanks in advance.
teresedp
Dec 20 '10 #1
5 4670
ADezii
8,834 Recognized Expert Expert
Where, exactly, is LabelSetup() Declared? It appears that it needs to be Declared Privately in the Report's Class Module.
Dec 20 '10 #2
teresedp
3 New Member
As I said, I am very inexperienced with VBA--can you tell me where and how to declare it?

Thanks,
teresedp
Dec 21 '10 #3
ADezii
8,834 Recognized Expert Expert
  1. Open the Report in Design View
  2. View ==> Code
  3. Insert ==> Procedure
    1. Name = LabelSetup
    2. Type = Function
    3. Source = Private
  4. Type or Copy-N-Paste the Code between:
    Expand|Select|Wrap|Line Numbers
    1. Function LabelSetup()
    2.   'code goes here...
    3. End Function
Dec 21 '10 #4
teresedp
3 New Member
I tried that and it didn't work. But hadn't I already declared it in the original code snippet I posted?
Expand|Select|Wrap|Line Numbers
  1.  '*********************************************************
  2.     'Declarations section of the module.
  3.    '**********************************************************
  4.  
  5.   Option Compare Database
  6.   Option Explicit
  7.  
  8.   Dim LabelBlanks&
  9.   Dim LabelCopies&
  10.   Dim BlankCount&
  11.   Dim CopyCount&
  12.  
  13.   '==========================================================
  14.     ' The following function will cause an input box to
  15.     ' display when the report is run that prompts the user
  16.     ' for the number of used labels to skip and how many
  17.     ' copies of each label should be printed.
  18.  '==========================================================
  19.  
  20.   Function LabelSetup ()
  21.      LabelBlanks& = Val(InputBox$("Enter Number of blank  
  22.           labels to skip"))
  23.      LabelCopies& = Val(InputBox$("Enter Number of 
  24.           Copies to Print"))
  25.      If LabelBlanks& < 0 Then LabelBlanks& = 0
  26.      If LabelCopies& < 1 Then LabelCopies& = 1
  27.   End Function
  28.  
Other than the function now saying "Private" before it, it looks no different.

teresedp
Dec 22 '10 #5
ADezii
8,834 Recognized Expert Expert
This is only the Function Declaration, where is the remainder of the Code?
Dec 22 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5883
by: narasingarao | last post by:
Hi to group, I'm a student of M.C.A. from B.I.T. Ranchi...I'm in my project period here i have to migrate the MS-Access database table to Oracle data base tables...so, please help me in getting...
2
5710
by: Stephen | last post by:
I am getting the following error when I am trying to send a report as an email attachment "Microsoft Access Can't Open the Mail Session" On the knowledge base on the MS site it says that this...
34
18208
by: John Harrison | last post by:
An odd confession; an odd request; but here's the tale.... My company has a few PC systems which we have used for about 7 years and not updated - we've "made do", and besides, "if it ain't...
1
2874
by: bonnie.tangyn | last post by:
Hello all I get Too few parameters expected 2 error and "The MS Jet Database engine cannot find the input table or query "myTempTablename". Make sure it exists and that its name is spelled...
2
14238
by: PW | last post by:
Hi, What the heck is that supposed to mean? I am getting this error on a "Me.Requery" line in a subroutine on a form, but only when I select something from a combo/dropdown box. The *exact*...
3
17120
by: klaritydefect | last post by:
Hi, I am receving the following error when I run my application (build on C ++ code) Program received signal SIGSEGV, Segmentation fault si_code: 1 - SEGV_MAPERR - Address not mapped to...
5
23750
by: vipinkrajput | last post by:
Hi, i m using javascript for writing in a file,the code is correctly working with IE 6.0, i m getting the error like "Automation server can't create object" in IE 7.0 while using...
0
4240
by: dim505 | last post by:
hi friends, I'm new to this forum. I have created and build a dll but at first it was getting the error"Automation server can't create object" after a lot of head ache,I got the script...
2
31736
by: tridirk | last post by:
Hi; I am getting a Objceted Expected Error on my forum site. I can't find what is wrong? Line: Char: Error: Object expected Code:0 the site is My SMF Forum
4
3313
by: kapilsri22 | last post by:
Hi All, I am trying to use PDF::API2 module . Since i do not have the root access, I installed the above module locally at ~/some_dir/lib. The contents of ~/some_dir/lib are : ...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7307
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7021
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4701
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.