Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Dates and Variables

I'm trying to hit a stored procedure in SQL but I'm getting an error when I'm
passing anything that needs the quotes " " for SQL.

How do I pass the quotes in a variable?

I'm sure it's amazingly simple but I'm lost.
objCmd(1) = "10/25/2000"

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Dates and Variables

did you try the double quote

objCmd(1) = ""10/25/2000""
or objCmd(1) = """&10/25/2000&"""



"Michael$Lost" wrote:

I'm trying to hit a stored procedure in SQL but I'm getting an error when I'm
passing anything that needs the quotes " " for SQL.

How do I pass the quotes in a variable?

I'm sure it's amazingly simple but I'm lost.
objCmd(1) = "10/25/2000"

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Dates and Variables

Yeah it doesn't like the double qoutes

"gocush" wrote:

did you try the double quote

objCmd(1) = ""10/25/2000""
or objCmd(1) = """&10/25/2000&"""



"Michael$Lost" wrote:

I'm trying to hit a stored procedure in SQL but I'm getting an error when I'm
passing anything that needs the quotes " " for SQL.

How do I pass the quotes in a variable?

I'm sure it's amazingly simple but I'm lost.
objCmd(1) = "10/25/2000"

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Dates and Variables



Hi Michael,

I believe you'll find that the previously supplied example is short a
quotation mark, Try this example:


Sub QuoteMe()
Dim strParameter As String

strParameter = "10/25/2000"

MsgBox """" & strParameter & """"

End Sub



Note that the parameter value is surrounded by 4 (four) quote marks.

Good Coding

OfficeHacker
Melbourne, Australia

"Michael$Lost" wrote:

I'm trying to hit a stored procedure in SQL but I'm getting an error when I'm
passing anything that needs the quotes " " for SQL.

How do I pass the quotes in a variable?

I'm sure it's amazingly simple but I'm lost.
objCmd(1) = "10/25/2000"

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Dates and Variables


Michael$Lost wrote:
I'm trying to hit a stored procedure in SQL but I'm getting an error

when I'm
passing anything that needs the quotes " " for SQL.

How do I pass the quotes in a variable?

I'm sure it's amazingly simple but I'm lost.
objCmd(1) = "10/25/2000"


Instead of double quotes Chr$(34), try single quotes Chr$(39), which is
ANSI standard syntax. BTW if your column is a temporal data type (e.g.
DATETIME), try using an unambiguous date format e.g.

objCmd(1) = Chr$(39) & "2000-10-25" & Chr$(39)

Note your product may have a different 'date delimiter' e.g. MS Access
uses the hash character Chr$(39).

Jamie.

--

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
Linking computer dates (time) to spreadsheet dates that have formu bigisle Excel Worksheet Functions 3 January 3rd 10 08:05 PM
compare 2 tables of dates to find the preceding dates Babi Excel Worksheet Functions 3 October 28th 08 05:52 AM
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
Identifying unique dates in a range of cells containing dates... cdavidson Excel Discussion (Misc queries) 4 October 13th 06 03:30 PM
Identifying unique dates within a range of cells containing dates cdavidson Excel Discussion (Misc queries) 0 October 12th 06 08:19 PM


All times are GMT +1. The time now is 01:04 AM.

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"