473,322 Members | 1,401 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,322 software developers and data experts.

SQL OpenQuery

102 64KB
Front end= MS Access/VBA 2010
Back end= MS SQL Server 2008

I have the following code that produces the following error message: Microsoft Access can't find the object 'Select * FROM dbo_DB WHERE userDB='FGulley' AND db='001';'.

gblSQL = "Select * FROM dbo_DB WHERE userDB= '" & gblUser & "' AND db=" & "'001';"
DoCmd.OpenQuery gblSQLWhat is wrong?

Thanks.
Jan 19 '15 #1

✓ answered by jforbes

I think you want to use DoCmd.OpenRecordset instead of DoCmd.OpenQuery as OpenQuery will only open a named Query in the Access Database.

DoCmd.OpenQuery
DoCmd.OpenRecordset

1 3329
jforbes
1,107 Expert 1GB
I think you want to use DoCmd.OpenRecordset instead of DoCmd.OpenQuery as OpenQuery will only open a named Query in the Access Database.

DoCmd.OpenQuery
DoCmd.OpenRecordset
Jan 19 '15 #2

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

Similar topics

1
by: Phil Sandler | last post by:
Hello, Quick, and possibly strange, question. I am doing some work testing the running time of some dynamic SQL statements on a remote machine. What I would like to do is execute the SQL on...
2
by: addi | last post by:
All, Can someone help me with the following SQL and help me write it in an OPENQUERY format. I am running the following code from a SQL Server 7 box, trying to update a table in an Oracle Linked...
2
by: Chris | last post by:
In SQL Server 2000 I have set up an Oracle linked server. When I run the following query it runs fine:- SELECT * FROM OPENQUERY(LINKEDSERVERNAME,'SELECT * FROM ORACLETABLENAME') However...
3
by: douglascfast | last post by:
Anyone, Is this possible? I am connecting to a TeraData server via MS SQL 8.0 using the OpenQuery statement. I need to pass a list of ever-changing deal numbers My list of numbers are...
0
by: noor | last post by:
Hi I'm working on linked server which uses db2oledb. When I tried simple select query it didn't ran because the queries condition was based on column having special character. Query was like that...
3
by: jj | last post by:
I've got a form button that fires off 3 queries but if the first query returns an error, I don't want the other two queries to happen. Example: first query runs an insert from a linked table but...
2
by: savvy | last post by:
I'm performing a particular word Search in MS Word, Text, PDF docs and displaying the results through Index Server linked to SQL Server when it is matched. For which I'm using Openquery in the...
2
by: savvy | last post by:
I'm performing a particular word Search in MS Word, Text, PDF docs and displaying the results through Index Server linked to SQL Server when it is matched. For which I'm using Openquery in the...
5
by: alingsjtu | last post by:
Hello, every body. When execute dynamic generated multiple OPENQUERY statements (which linkes to DB2) in SQLServer, I always got SQL1040N The maximum number of applications is already connected...
10
by: teddysnips | last post by:
My clients have asked me to maintain a database that was developed in- house. It's pretty good, considering the developer isn't a "programmer". The first thing they want me to do is to split it...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.