Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ADO SQL: Im getting CRAZY


Hi all!

I cant solve very simple task.
All I need is a query "SELECT * FROM Table WHERE Field LIKE '*value*'"

But it seems Microsoft is too huge company to let me just do that like
in PHP.

Im using DAO because hope it will work more often then ADO now do :)

1) DAO worked ONLY whith syntax [TableName$] but most of examples not
using it.
2) I have working query

Sql = "SELECT * FROM [TestList$]"
Set rs = db.OpenRecordset(Sql)

3) But cant make work WHERE clause like this:

"SELECT * FROM [TestList$] WHERE A LIKE 'asdas'"

It gives me Run-Time 3061. In the internet I read about some
_parameters_ in query.
Anybody can tell me which more PARAMETERS wants from me crazy excel
programmres?

Or just wrong syntax?
Please help.


--
VladimirM
------------------------------------------------------------------------
VladimirM's Profile: http://www.excelforum.com/member.php...o&userid=24993
View this thread: http://www.excelforum.com/showthread...hreadid=385216

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default ADO SQL: Im getting CRAZY

The syntax is OK but I think probably the interpreter is having some trouble
due to ambiguity in the names (it is interpreting the [TestList$] as a
parameter, apparently - but only when you have the WHERE clause). The first
thing I would try is to give a complete reference to your WHERE clause like
this:
"SELECT * FROM [TestList$] WHERE [TestList$].[A] LIKE 'asdas'"
This might help MS Jet (assuming you are using Access) interpret the table
name and column correctly.

If that does not work, try building the query - at least this simple one -
using MSQuery instead of directly through ADO, and then view the SQL code
within MSQuery to see how it is written there. If you can get the query to
run in MSQuery, you can see what the proper syntax looks like and modify it
however you need to.

"VladimirM" wrote:


Hi all!

I cant solve very simple task.
All I need is a query "SELECT * FROM Table WHERE Field LIKE '*value*'"

But it seems Microsoft is too huge company to let me just do that like
in PHP.

Im using DAO because hope it will work more often then ADO now do :)

1) DAO worked ONLY whith syntax [TableName$] but most of examples not
using it.
2) I have working query

Sql = "SELECT * FROM [TestList$]"
Set rs = db.OpenRecordset(Sql)

3) But cant make work WHERE clause like this:

"SELECT * FROM [TestList$] WHERE A LIKE 'asdas'"

It gives me Run-Time 3061. In the internet I read about some
_parameters_ in query.
Anybody can tell me which more PARAMETERS wants from me crazy excel
programmres?

Or just wrong syntax?
Please help.


--
VladimirM
------------------------------------------------------------------------
VladimirM's Profile: http://www.excelforum.com/member.php...o&userid=24993
View this thread: http://www.excelforum.com/showthread...hreadid=385216


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default ADO SQL: Im getting CRAZY

Hi Vladimir,

Before I go off in the wrong direction and give you an answer to a question
that you haven't asked, can you confirm a couple of things for me/us please?

Do I understand correctly that you are trying to use VBA, ADO and/or DAO
from one Excel workbook to fire off a query and return some records from a
table (named range or worksheet) in some other Excel workbook?

Or is it some VBScript that you're looking for us to help you with in order
to return a recordset to a web page?

Grateful if you can please confirm and provide a bit more information in
regards to your purpose and that will give me/us the best chance to help you
to help yourself. Any code snippets of how far you've already got would
probably assist too.

(As an aside, personally I normally prefer ADO over DAO and regardless, the
LIKE operator is always a bit tricky because you have to use the SQL
'flavour' and syntax that the host provider/database understands.)

Cheers, Sean.

"VladimirM" wrote:


Hi all!

I cant solve very simple task.
All I need is a query "SELECT * FROM Table WHERE Field LIKE '*value*'"

But it seems Microsoft is too huge company to let me just do that like
in PHP.

Im using DAO because hope it will work more often then ADO now do :)

1) DAO worked ONLY whith syntax [TableName$] but most of examples not
using it.
2) I have working query

Sql = "SELECT * FROM [TestList$]"
Set rs = db.OpenRecordset(Sql)

3) But cant make work WHERE clause like this:

"SELECT * FROM [TestList$] WHERE A LIKE 'asdas'"

It gives me Run-Time 3061. In the internet I read about some
_parameters_ in query.
Anybody can tell me which more PARAMETERS wants from me crazy excel
programmres?

Or just wrong syntax?
Please help.


--
VladimirM
------------------------------------------------------------------------
VladimirM's Profile: http://www.excelforum.com/member.php...o&userid=24993
View this thread: http://www.excelforum.com/showthread...hreadid=385216


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ADO SQL: Im getting CRAZY


Hi, Sean!

thank you for yuor answer.
That was Excel book, but I already solved my problem.

This error appears when wrong fields name in a query.

I must name it F1, F2 ... But this information I could get from one o
the phorums only.

Vladimi

--
Vladimir
-----------------------------------------------------------------------
VladimirM's Profile: http://www.excelforum.com/member.php...fo&userid=2499
View this thread: http://www.excelforum.com/showthread.php?threadid=38521

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ADO SQL: Im getting CRAZY


Hi, Sean!

thank you for yuor answer.
That was Excel book, but I already solved my problem.

This error appears when wrong fields name in a query.

I must name it F1, F2 ... But this information I could get from one of
the phorums only.

Vladimir


--
VladimirM
------------------------------------------------------------------------
VladimirM's Profile: http://www.excelforum.com/member.php...o&userid=24993
View this thread: http://www.excelforum.com/showthread...hreadid=385216

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need help with a formula PLEASE I am going crazy Mandy Excel Discussion (Misc queries) 8 September 4th 08 01:01 AM
Crazy If LiveUser Excel Worksheet Functions 1 January 30th 08 02:44 PM
I'm going crazy here famdamly Excel Discussion (Misc queries) 2 December 9th 05 06:15 PM
Help I am going crazy with this formula. laz Excel Worksheet Functions 4 November 10th 05 10:22 PM
This is crazy!!! Chris Excel Discussion (Misc queries) 1 August 10th 05 05:06 PM


All times are GMT +1. The time now is 01:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"