Ask Experts Questions for FREE Help!
Ask

Automation object, not contained?

Asked Feb 12, 2012, 12:48 PM — 3 Answers
Version 2002 of Access. I have a Menu form (not connected to a table). It mostly contains macro buttons, but one field should reflect the last assigned autonumber in a receipt table (called tblTaxReceiptNumbers, fieldname TaxReceiptNo) I have a query called qryLastReceiptNo that displays one field TaxReceiptNo sorted Descending with Top Values =1 that wonderfully gives me the number; however I can't display it in my menu field. I get the dialog/error "The object doesn't...etc." I've tried the SetValue in a macro with the two properties identified...same result. Everything else seems to work. Pressing Ctrl G and looking in References shows VB for Apps; Access 10.0 object library; OLE Automation; and MS ActiveX Data Objects 2.1 Library. Anything else I should be checking?

3 Answers
ScottGem's Avatar
ScottGem Posts: 50,818, Reputation: 25241
Computer Expert and Renaissance Man
 
#2

Feb 15, 2012, 06:52 PM


Use a DLookup to pull the value from your query or a DMax to pull the value from the table. Use the expression as the ControlSource of the text control.
__________________
Hope this helps, Scott<>
P.S. Please post a response to let us know whether our answer helped or not.

Scottgem's Blog
Microsoft Access MVP since 2007
Author:
Microsoft Office Access 2007 VBA
Helpful
wilpeter's Avatar
wilpeter Posts: 2, Reputation: 10
Junior Member
 
#3

Feb 21, 2012, 10:40 AM
Thanks for your response. I've tried both these expressions in the Control Source property of the table's field Lastest:
DMax([TblReceiptNumbers]![TaxReceiptNo])
DLookup([qryLastReceiptNo]![TaxReceiptNo])
and each provides the same result, which is #Name?
Am I correctly interpreting your suggesion?
Helpful
ScottGem's Avatar
ScottGem Posts: 50,818, Reputation: 25241
Computer Expert and Renaissance Man
 
#4

Feb 21, 2012, 01:40 PM


Yes, but not implementing it properly. First a table doesn't have controlsources, so you must be referring to a form.

You needed to lookup the correct syntax for a DMAX. Thje syntax is:

DMax("[fieldname]","tablename")

So if TaxReceiptNo is your field and TblReceiptNumbers your table then use:

=DMax("[TaxReceiptNo]","TblReceiptNumbers")

as the controlsource. Or use:

=DLookup("[TaxReceiptNo]","qryLastReceiptNo")
__________________
Hope this helps, Scott<>
P.S. Please post a response to let us know whether our answer helped or not.

Scottgem's Blog
Microsoft Access MVP since 2007
Author:
Microsoft Office Access 2007 VBA
Helpful  (1)

Not your question? Ask your question View similar questions

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Add your answer here.

Remove Text Formatting

Undo
Redo
 
Decrease Size
Increase Size
Bold
Italic
Underline
Align Left
Align Center
Align Right
Ordered List
Unordered List
Decrease Indent
Increase Indent
Insert Email Link
Wrap [QUOTE] tags around selected text
Wrap [CODE] tags around selected text
Wrap [HTML] tags around selected text
Wrap [PHP] tags around selected text
Wrap [YOUTUBE] tags around selected text
Notification Type:



Check out some similar questions!

Object doesn't contain automation object [ 1 Answers ]

Scrolling through Northwind Database sample. 'Opening the "Customer Phone List" Form. When I click on the alphabets below, I receive an information that the "The object doesn't contain the Automation object 'RecordsetClone.'" Please can you explain why and can you help me out? I want to design...

The object doesn't contain the Automation object '|.' [ 1 Answers ]

Hello, And thank you for taking this question. I currently support a small Access system and ran into the error mentioned in the title. I believe that the issue is system-specific because I ran the system from my desktop and printed fine. The issue centers around the cmdPrint command function. ...

Word Automation [ 1 Answers ]

Hi friends My name is Ramesh. And I need help regarding Word Automation through ASP.NET. I am trying to generate a Word Document stored on the Server. My code is:- Word.Application wApp=new Word.ApplicationClass(); Word.Document wDoc; WApp.Visible=true; WApp.Caption="Demo Questionnaire...

Automation object [ 1 Answers ]

I wonder if you could help me? I started recentley working in a company. I am at the moment working on some listings of data bases in Access 2000. I was trying to make e customers phone list with the form similar to the one at Northwind Example. Everything went well with the table, form...


View more Access questions Search