Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Oliver Ferns via OfficeKB.com
 
Posts: n/a
Default

Hi,
I would hardcode the SQL Statements (Select, From, Where, Between) in to
Global variables as such....

Private Const sqlSelect As String = "SELECT b.OrgID, a.OrgName, "
Private Const sqlFrom as String = " FROM tblossevent AS b, tbOrg AS a"
Private Const sqlWhere as String = " WHERE "
Private Const sqlBetween as String = " BETWEEN convert(varchar, _
getdate()-30, 106) AND convert(varchar,getdate(), 106)"

You can then construct your SQL statement fairly easily with the following
syntax:

Let strSQL = sqlSelect & sqlFrom & sqlWhere & YourVariable & sqlBetween

Then you can use strSQL as your SQL string!
Does this help?

Oli

--
Message posted via http://www.officekb.com
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
Extract Data From Textbox SEA Excel Worksheet Functions 6 February 5th 09 08:21 PM
extract data from cells Nicole L. Excel Worksheet Functions 2 February 2nd 05 08:54 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
Combo box copy data Steve Excel Discussion (Misc queries) 1 December 22nd 04 12:00 AM
Formula to Extract Data from a Table Macshots Excel Worksheet Functions 2 November 5th 04 06:35 AM


All times are GMT +1. The time now is 02:14 AM.

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"