473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

The object doesn't contain the automation object

Hello, Would someone please be able to help me. I had to change a key field (GroupNo) in a table from Numeric to Text. This has cause all kinds of problems in code in a database I did not write but am trying to help fix. This field is referenced everywhere so expressions and functions, etc. are all now having to be reviewed and updated. Currently I am getting this error:

The expression you entered as a query parameter produced this error: 'The object doesn't contain the Automation object 'K006."

It is occurring on this line of code:
Expand|Select|Wrap|Line Numbers
  1. Public Function doQueryDefSQL(ByRef fromWhere As String, Optional keyNow As Variant = "") As Boolean
  2. Dim bHasLocs As Boolean
  3. 'more code here...
  4.  If Nz(DCount("*", "Accounts", "Location<>'0' and GroupNo = " & keyNow), 0) > 0 Then bHasLocs = True 
  5.  
When I click OK then this error is thrown:

Run-time error '0': Reserved Error

keyNow is returning as a VariantString of "K006"

This is urgently needed today if anyone can assist.
Much thanks!
Jul 9 '15 #1

✓ answered by Rabbit

If GroupNo is a string now, then you need to surround the value in single quotes the same way you do with location.

8 3756
Rabbit
12,516 Expert Mod 8TB
If GroupNo is a string now, then you need to surround the value in single quotes the same way you do with location.
Jul 9 '15 #2
Hi Rabbit,
I made several attempts changing where the quotes should be and finally was successful with this:

Expand|Select|Wrap|Line Numbers
  1. If Nz(DCount("*", "Accounts", "Location<>'0' and GroupNo = ' & keyNow & '"), 0) <> 0 Then bHasLocs = True
  2.  
However, it is returning 0 and should be returning a count other than 0. I broke it down and it looks like DCount("*", "Accounts", "GroupNo = ' & keyNow & '") is evaluating incorrectly. keyNow currently has a value of "K006" and there are at least 2 additional locations in the table other than location 0 for K006, so what am I doing wrong?

Thanks!
Jul 9 '15 #3
Rabbit
12,516 Expert Mod 8TB
The key now and the ampersands still need to be outside the double quotes.
Jul 9 '15 #4
I apologize for my ignorance but appreciate your help. However, when I do as you state above:

Expand|Select|Wrap|Line Numbers
  1. DCount("*", "Accounts", "GroupNo = "' & keyNow & ')
  2.  
then I get a compile error Expected list separator or ).
Jul 9 '15 #5
zmbd
5,501 Expert Mod 4TB
Your issue is the additional quotes?

Expand|Select|Wrap|Line Numbers
  1. DCount("*", "Accounts", "GroupNo = "' & keyNow & ')
  2.  
instead:
Expand|Select|Wrap|Line Numbers
  1. DCount("*", "Accounts", "GroupNo = '" & keyNow & "'")
  2.  
This is why I usually build the string first and then use in the function... you can debug.print the string for troubleshooting.

Expand|Select|Wrap|Line Numbers
  1. sSQL = "GroupNo = '" & keyNow & "'"[/icode]
  2. '
  3. 'allowing you to view the string after running in the immediate pane via <ctrl><g>
  4. 'just uncomment the line
  5. 'debug.print sSQL 
  6. '
  7. DCount("*", "Accounts", sSQL)
  8.  
Jul 9 '15 #6
That did it! Thank you both for your patience! I really appreciate it. Learning on the fly and under the gun I guess sometimes has it's advantages.
Jul 9 '15 #7
zmbd
5,501 Expert Mod 4TB
Our pleasure.
Thank you for selecting my post as best answer (warm fuzzys); however, I've reset and selected Rabbit's post given that I only piggy-backed upon his efforts. :)
Jul 9 '15 #8
Yes, you both were helpful!
Jul 9 '15 #9

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

Similar topics

3
by: Gigi | last post by:
Hi, I need access to a function object that corresponds to a frame object in a certain case from inside the function. I can get the frame object using: f = sys._getframe(0) But the...
6
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object...
10
by: Steven Blair | last post by:
Hi, Quick overview of the problem: public bool Something( out DataSet ds ) { bool ret=false; try {
0
by: a | last post by:
I have a custom object that inherits from CollectionBase and it does not successfully bind to GridViews or DropdownLists. My understanding is that that is because GridViews and Dropdownlists...
13
by: Fredrik Strandberg | last post by:
Hi! I receive an object as a System.Object argument to a method. I need to check if the object is a Type object or not (that is, not a specific type, but if the object is a type object in...
1
by: acog1 | last post by:
Hi everyone, I know that there is a question similar to this already posted but the answer to it does not really seem to relate to my problem! So here goes... I have a main form which has a tab...
10
by: Jess | last post by:
Hello, If I create a temporary object using a dynamically created object's pointer, then when the temporary object is destroyed, will the dynamically created object be destroyed too? My guess...
3
by: callre | last post by:
when i used javascript onchange() the error is coming "object doesnt support this property" my code is- <script type='text/javascript' language="javascript"> function change() { ...
3
by: =?Utf-8?B?S2F5xLFoYW4=?= | last post by:
In my project,i added datagridview to my form , i transfered my table to datagridview and added multiple rows and when i called dataadapther.update ,,result is ok. But when i tried it for the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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
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,...

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.