Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Proper SQL Syntax - DAO

All -

I have reviewed the sample code at
http://www.bygsoftware.com/Excel/SQL/UsingSql.html
regarding the querying of an Access Database from Excel utilizing the DAO
library.

Below is the sample SELECT SQL Stmt from their web site:

vtSql = ""
vtSql = vtSql & " SELECT * "
vtSql = vtSql & " FROM " & ctSheet
vtSql = vtSql & " WHERE Namex Like 'R*'"

(ctSheet in the above example is Access Table Name).

QUESTIONS:
------------------
1. Instead of Field Name "Namex" I would like to query for Field Name
"Datex" greater than a particular date (say 01/01/2006). What is the proper
SQL syntax for such a request?

2. Is there something special about the field type your are requesting and
how you code the SQL string?

3. Is the WHERE SQL stmt on numeric field request different than the WHERE
SQL stmt on a date field request?

Thank you for your assistance.

MSweetG222

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Proper SQL Syntax - DAO

Hello,

1. Datex = #01/01/2006#
(I am assuming you meant greater than or equal to)

2.
-strings are delimited with quotes, either single or double,
as long as they match
-dates are delimited with #
-numbers are not delimited

3. only that the dates are delimited and numbers aren't
(dates are actually stored as numbers, but they are written
differently)

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access



MSweetG222 wrote:
All -

I have reviewed the sample code at
http://www.bygsoftware.com/Excel/SQL/UsingSql.html
regarding the querying of an Access Database from Excel utilizing the DAO
library.

Below is the sample SELECT SQL Stmt from their web site:

vtSql = ""
vtSql = vtSql & " SELECT * "
vtSql = vtSql & " FROM " & ctSheet
vtSql = vtSql & " WHERE Namex Like 'R*'"

(ctSheet in the above example is Access Table Name).

QUESTIONS:
------------------
1. Instead of Field Name "Namex" I would like to query for Field Name
"Datex" greater than a particular date (say 01/01/2006). What is the proper
SQL syntax for such a request?

2. Is there something special about the field type your are requesting and
how you code the SQL string?

3. Is the WHERE SQL stmt on numeric field request different than the WHERE
SQL stmt on a date field request?

Thank you for your assistance.

MSweetG222

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Proper SQL Syntax - DAO

Crystal,

Thank you so much.
I understand.

Thx
MSweetG222



"Crystal" wrote:

Hello,

1. Datex = #01/01/2006#
(I am assuming you meant greater than or equal to)

2.
-strings are delimited with quotes, either single or double,
as long as they match
-dates are delimited with #
-numbers are not delimited

3. only that the dates are delimited and numbers aren't
(dates are actually stored as numbers, but they are written
differently)

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access



MSweetG222 wrote:
All -

I have reviewed the sample code at
http://www.bygsoftware.com/Excel/SQL/UsingSql.html
regarding the querying of an Access Database from Excel utilizing the DAO
library.

Below is the sample SELECT SQL Stmt from their web site:

vtSql = ""
vtSql = vtSql & " SELECT * "
vtSql = vtSql & " FROM " & ctSheet
vtSql = vtSql & " WHERE Namex Like 'R*'"

(ctSheet in the above example is Access Table Name).

QUESTIONS:
------------------
1. Instead of Field Name "Namex" I would like to query for Field Name
"Datex" greater than a particular date (say 01/01/2006). What is the proper
SQL syntax for such a request?

2. Is there something special about the field type your are requesting and
how you code the SQL string?

3. Is the WHERE SQL stmt on numeric field request different than the WHERE
SQL stmt on a date field request?

Thank you for your assistance.

MSweetG222


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
Proper syntax for this Barb Reinhardt Excel Discussion (Misc queries) 1 August 4th 06 02:15 PM
proper syntax order Roberta H via OfficeKB.com Excel Worksheet Functions 2 January 18th 06 10:14 PM
Proper Syntax for Date Modified? Marty Excel Programming 1 January 29th 05 04:58 PM
proper syntax in code needed Jim May Excel Programming 2 September 19th 04 12:44 AM
Proper syntax to Set a Workbook Object? Rick Stanford Excel Programming 2 September 13th 03 07:15 PM


All times are GMT +1. The time now is 09:43 PM.

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

About Us

"It's about Microsoft Excel"