Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default #N/A Using SQL.REQUEST

Hi folks,

I'm using SQL.REQUEST to query MSDE 2000 With Excel 2002. Normally this
works splendidly, but I have one table that is giving me fits. Using the
following string (or similar):

=SQL.REQUEST("DSN=AF;UID=***;PWD=***;DATABASE=Cust omers",,2,"SELECT
SourceName
FROM tblSourceRef
WHERE Code="&$P$11&"")

I simply get #N/A returned to the cell. I've tried many, many variations to
get to the bottom of this. The table I'm querying from originally had a
space in the name (tblSourceRef was TBL SourceRef) and I thought maybe that
was my problem, but alas, no. I can use the same worksheet, and the same
basic statement, to collect any other data from any other table in this
database. I have also tried replacing the variable P11 with a static value.
I have used MS Query to query this table, and it has worked fine. I have
also tried the fully qualified names (i.e., "Customers.dbo.tblSourceRef")
but to no avail.

What am I missing here?

The object is to type a customer "Code" into a cell and return the
"SourceName", "Address", and other info one piece at a time into separate
cells.

--

Mike Brown
Process Manager

Asset Forwarding Corp.
EPA-compliant Recycling
DoD 5220.22-M Data Elimination
http://www.assetforwarding.com


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default #N/A Using SQL.REQUEST

Hi Mike,

Is the column "Code" a text-based column? If so, you may need to wrap the
value with single quotes:

"SELECT SourceName FROM tblSourceRef WHERE
Code='" & $P$11 & "'"

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Mike Brown wrote:
Hi folks,

I'm using SQL.REQUEST to query MSDE 2000 With Excel 2002. Normally
this works splendidly, but I have one table that is giving me fits.
Using the following string (or similar):

=SQL.REQUEST("DSN=AF;UID=***;PWD=***;DATABASE=Cust omers",,2,"SELECT
SourceName
FROM tblSourceRef
WHERE Code="&$P$11&"")

I simply get #N/A returned to the cell. I've tried many, many
variations to get to the bottom of this. The table I'm querying from
originally had a space in the name (tblSourceRef was TBL SourceRef)
and I thought maybe that was my problem, but alas, no. I can use the
same worksheet, and the same basic statement, to collect any other
data from any other table in this database. I have also tried
replacing the variable P11 with a static value. I have used MS Query
to query this table, and it has worked fine. I have also tried the
fully qualified names (i.e., "Customers.dbo.tblSourceRef") but to no
avail.

What am I missing here?

The object is to type a customer "Code" into a cell and return the
"SourceName", "Address", and other info one piece at a time into
separate cells.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default #N/A Using SQL.REQUEST

"Jake Marx" wrote in message
...
Hi Mike,

Is the column "Code" a text-based column? If so, you may need to wrap the
value with single quotes:

"SELECT SourceName FROM tblSourceRef WHERE
Code='" & $P$11 & "'"

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com



Jake,

That was it. *Kicks self*

Thanks for the help, in less than 10 minutes at that!

Mike


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default #N/A Using SQL.REQUEST

Mike Brown wrote:
"SELECT SourceName FROM tblSourceRef WHERE
Code='" & $P$11 & "'"


That was it. *Kicks self*

Thanks for the help, in less than 10 minutes at that!


No problem, Mike - glad to help. Sometimes we just need a fresh set of eyes
to find bugs. <g

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

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
If then request bpc Excel Worksheet Functions 1 September 22nd 09 06:35 PM
Request chsjk Excel Worksheet Functions 1 January 31st 06 07:40 PM
sql.request teepee Excel Discussion (Misc queries) 2 December 30th 05 01:34 PM
CHR( ) request Bony Pony Excel Worksheet Functions 3 March 7th 05 09:29 PM
2nd request Christy[_2_] Excel Programming 0 October 1st 03 01:32 AM


All times are GMT +1. The time now is 06:31 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"