navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

I need help with a Date Lookup Query

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> I need help with a Date Lookup Query
Page: [1]
 
DaveKstl

 

Posts: 547
Joined: 4/21/2004
Status: offline

 
I need help with a Date Lookup Query - 1/25/2008 15:35:22   
I have a Text Field in a form DateText

In my Table I have 3 date fields:

BegDate________EndDate_________PeriodDate
01/05/2008_____ 02/04/2008______02/01/2008

My challenge is the syntax for the query

mySQL = "Select PeriodDate From Table Where Request.Form("DateText") Between BegDate AND EndDate"

I realize that the SQL syntax is incorrect, I have tried several methods and get either Data mismatch or other errors.

How do I convert a Text Field to be used in the above query?

Thanks
Spooky

 

Posts: 26597
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: I need help with a Date Lookup Query - 1/25/2008 16:18:59   
Which dates form part of the query?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to DaveKstl)
DaveKstl

 

Posts: 547
Joined: 4/21/2004
Status: offline

 
RE: I need help with a Date Lookup Query - 1/25/2008 17:41:31   
Not sure I understand but

mySQL = "Select PeriodDate From Table Where Request.Form("DateText") Between BegDate AND EndDate"

The customer enters the Request.Form("DateText") let's say 1/25/2008 as a text entry.

The lookup then check for a value Between BegDate (beginning) AND EndDate (end).

So the BegDate = 01/05/2008 and the EndDate in the table is 02/04/2008, 1/25/2008 falls between so I should get a return PeriodDate of 2/1/2008

Unfortunately, I am challenged with the Text Filed form the form being changed to a value value that works in the query.


(in reply to Spooky)
Spooky

 

Posts: 26597
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: I need help with a Date Lookup Query - 1/25/2008 19:27:26   

mySQL = "Select PeriodDate From Table Where #"&DtVar&"#  Between BegDate AND EndDate" 

You would need to ensure DtVar is a valid date something like so :

DtVar = Request.Form("DateText")
If isDate(DtVar) then
' ok
else
 'error
end if


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to DaveKstl)
DaveKstl

 

Posts: 547
Joined: 4/21/2004
Status: offline

 
RE: I need help with a Date Lookup Query - 1/28/2008 7:31:06   
quote:

mySQL = "Select PeriodDate From Table Where #"&DtVar&"# Between BegDate AND EndDate"


Thanks.

I should know this, but I don't

So a text field does not need to be converted before the data is placed in a query? It is the query that adjusts the data before it is written.

So:

Date is #&DteVar&#
Number is '&NumVar&'
Text is '"&TextVar&&"'

(in reply to Spooky)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> I need help with a Date Lookup Query
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts