SQL syntax help

W

Wayne

I'm working with calendar based on an Access db in my website, and I'm long
out of practise on SQL syntax. When a page loads, there's a javascript that
writes out a numeric date (YYYYMMDD) based on today's date, and passes that
result to a hidden text box. OK, fine. Now, how do I construct an SQL
statement to select records from my db where the Num_date field is equal to
(or greater than) the numeric date I've created in the javascript when the
page loads?

Here's what DOESN'T work:

s-sql="SELECT * FROM cal_db WHERE (Num_date =
'document.clock.thedate.value')"

where Num_date is the database field, the form is named "clock" and the text
box name is "thedate".

Yes, I'm pretty sure the entire process is back-asswards, but hey...
everything else I need seems to work...
 
J

Jens Peter Karlsen[FP MVP]

You first need to get the value from the forms collection.
Try using the Data result wizard to generate a sample page for you.

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
S

Stefan B Rusynko

Skip the JavaScript and do it all server side

thedate = Date()

strWhere = "(Num_date = #" & thedate & "#)"
s-sql="SELECT * FROM cal_db WHERE " & strWhere




| I'm working with calendar based on an Access db in my website, and I'm long
| out of practise on SQL syntax. When a page loads, there's a javascript that
| writes out a numeric date (YYYYMMDD) based on today's date, and passes that
| result to a hidden text box. OK, fine. Now, how do I construct an SQL
| statement to select records from my db where the Num_date field is equal to
| (or greater than) the numeric date I've created in the javascript when the
| page loads?
|
| Here's what DOESN'T work:
|
| s-sql="SELECT * FROM cal_db WHERE (Num_date =
| 'document.clock.thedate.value')"
|
| where Num_date is the database field, the form is named "clock" and the text
| box name is "thedate".
|
| Yes, I'm pretty sure the entire process is back-asswards, but hey...
| everything else I need seems to work...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top