I need help with creating a query

S

Sproul

I'm assuming that you have already made this page, and are now pulling out
your hair cause i cant get it, I know that you are only trying to help and i
do appreciate it.

Also i have added the link below to my favourites incase i need to use it at
some point.

What i'm gonna do is delete the page again and start from fresh, i was
actually hoping that it could be done through a custom query.

Anyway i'll do it again, and write down exactly what i did.


Al....

Stefan B Rusynko said:
Good catch
Didn't even check that field name against the reserved ones at http://www.aspfaq.com/show.asp?id=2080

- best to just create a new field in the DB (or rename the existing one) w/ an unreserved name - say EditDate




| You may have to place the Timestamp field in square brackets -
| [Timestamp] - in the grey webbot code. Timestamp is a reserved word.
| --
| Ron Symonds
| Microsoft MVP (FrontPage)
| Reply only to group - emails will be deleted unread.
|
| | > Time in date/time field is not relevant
| > - it still has a date element to which you are adding (- 7) days
| >
| > Don't change your PC date, just change the value of - 7 to whatever
| > # days your data is aged to (0 is today)
| >
| > On a new page make a std DBRW query to see if you get any results
| > showing all DB fields and their values from the DB (look for
| > errors in CaSe or data types and what both Timestamp and D1 return)
| > Then add 1 criteria at a time to see where you are generating a
| > field mismatch or error
| >
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > | > | Ok the page comes up, still shows an error,
| > | In the search field the ChkDate is 7 days previous, Active is yes,
| > when
| > | submit query is clicked no records are show.
| > |
| > | I changed the date on my PC so that the ChkDate would match the
| > date of the
| > | records in the database and still no records found.
| > |
| > | Is there a way to do it by running a custom query, would it be
| > easier if i
| > | added another field with a date which is only dd/mm/yyyy and not
| > having the
| > | time.
| > |
| > | only thing is i don't know how to automatically add the date in a
| > hidden
| > | field.
| > |
| > | I've had a look at some Access query stuff but most of it is
| > pretty vaig, i
| > | suppose i'd ave to fully commit some quality time to it if i am to
| > learn
| > | anything, can you suggest any good books for a beginner to learn
| > from.
| > |
| > |
| > | Al....
| > |
| > | "Stefan B Rusynko" wrote:
| > |
| > | > Repost your new SQL string and criteria
| > | > Did you name the form fields and set their values as per my
| > original post
| > | >
| > | > PS
| > | > for more meaningful DBRW error messages open the hidden folder
| > /_fpclass/ and edit the fpdbrgn1.inc file
| > | >
| > | > At about line 19, change :
| > | > fp_DEBUG = False
| > | > to :
| > | > fp_DEBUG = True
| > | >
| > | >
| > | > --
| > | >
| > | > _____________________________________________
| > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > To find the best Newsgroup for FrontPage support see:
| > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > _____________________________________________
| > | >
| > | >
| > | > | > | Were a step further, the page is at least loading up but
| > there's an error
| > | > |
| > | > | Database Results Wizard Error
| > | > | The operation failed. If this continues, please contact your
| > server
| > | > | administrator.
| > | > |
| > | > | everything matches what you specified
| > | > |
| > | > | i also tried BlnActive = Yes and BlnActive = "Yes" still the
| > same error
| > | > |
| > | > |
| > | > | thanks Al....
| > | > |
| > | > | "Stefan B Rusynko" wrote:
| > | > |
| > | > | > Not quite
| > | > | >
| > | > | > These 3 line of code go in separate lines!
| > | > | > <%
| > | > | > Dim ChkDate, blnActive
| > | > | > ChkDate = DateAdd("d", -7, Date())
| > | > | > blnActive = True
| > | > | > %>
| > | > | >
| > | > | > Note:
| > | > | > You may need to use blnActive = Yes or blnActive = "Yes"
| > because of your field type being yes/no
| > | > | > - recommend instead changing your DB in Access to make the
| > Yes/No field a True/False field
| > | > | >
| > | > | > Add the code at the top of the page in code view (before the
| > <head> tag)
| > | > | > - because if where the DBRW will add the form code
| > | > | >
| > | > | > Set your Criteria to use the new variables - do not set
| > defaults!
| > | > | >
| > | > | > For Criteria set (using an AND)
| > | > | > Timestamp LessThan ChkDate
| > | > | > D1 Equals Active
| > | > | >
| > | > | > Should give you (each of below will be on 1 line)
| > | > | >
| > | > | > fp_sQry="SELECT * FROM Results WHERE (Timestamp <
| > '::ChkDate::' AND D1 = ::Active::)"
| > | > | >
| > | > | > fp_sDefault="ChkDate=&Active="
| > | > | >
| > | > | >
| > | > | > --
| > | > | >
| > | > | > _____________________________________________
| > | > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > | > To find the best Newsgroup for FrontPage support see:
| > | > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > | > _____________________________________________
| > | > | >
| > | > | >
| > | > | > | > | ok, here goes
| > | > | > |
| > | > | > | the time and date field is called Timestamp
| > | > | > | the checked field is called D1 (using test database) with
| > either a yes or no
| > | > | > |
| > | > | > | <% Dim ChkDate, blnActive ChkDate = DateAdd("d", -7,
| > Date()) ' subtracts 7
| > | > | > | days from today blnActive = True %>
| > | > | > |
| > | > | > | the code above was added in above the first grey txt (in
| > FP)
| > | > | > |
| > | > | > | criteria =
| > | > | > | Timestamp LessThan Timestamp
| > | > | > | D1 Equals D1
| > | > | > |
| > | > | > | Defaults =
| > | > | > | Timestamp <%=ChkDate%>
| > | > | > | D1 <%=blnActive%>
| > | > | > |
| > | > | > | code snippets as reqyuested
| > | > | > |
| > | > | > | fp_sQry="SELECT * FROM Results WHERE (Timestamp <
| > '::Timestamp::' AND D1 =
| > | > | > | '::D1::')"
| > | > | > | fp_sDefault="Timestamp=<%=ChkDate%>&D1=<%=blnActive%>"
| > | > | > |
| > | > | > |
| > | > | > | So that you don't think i'm being ignorant it's now time
| > for me to go,
| > | > | > | thanks for your help, i'll check in tomorrow.
| > | > | > |
| > | > | > |
| > | > | > | Al....
| > | > | > | "Stefan B Rusynko" wrote:
| > | > | > |
| > | > | > | > Do not change the new variables ChkDate or blnActive to
| > match your DB field names
| > | > | > | > - they have nothing to do w/ your DB field names (they
| > are variables to compare to)
| > | > | > | >
| > | > | > | > If the date field in your DB is a timestamp (date/time)
| > in your DB it will still work,
| > | > | > | > - what are the Actual field names for the date field
| > (timestamp) and "checked" field
| > | > | > | > - is your "checked" field (for my fictive "Active" field
| > name) a True/False (preferred) or Yes/No field type in Access
| > | > | > | >
| > | > | > | > You would use your field names Only in the DBRW criteria
| > (instead of my fictive fields named DatedEdited and Active) in
| > | > | > | > DatedEdited Less Than ChkDate
| > | > | > | > And
| > | > | > | > Active Equals blnActive
| > | > | > | >
| > | > | > | > Post a snippet of the Sql select you have (from
| > fp_sQry="...." and the names of your table plus the 2 DB field
| > names/types
| > | > | > | > --
| > | > | > | >
| > | > | > | > _____________________________________________
| > | > | > | > SBR @ ENJOY (-: [ Microsoft MVP -
| > FrontPage ]
| > | > | > | > "Warning - Using the F1 Key will not break anything!"
| > (-;
| > | > | > | > To find the best Newsgroup for FrontPage support see:
| > | > | > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > | > | > _____________________________________________
| > | > | > | >
| > | > | > | >
| > message | > | > | > | > | stefan thanks as it looks as though you put a bit of
| > effort into helping me
| > | > | > | > | but unfortunatley it didn't work, the page it's self
| > wont actually load, i'm
| > | > | > | > | not sure if it's the
| > | > | > | > | <%
| > | > | > | > | Dim ChkDate, blnActive
| > | > | > | > | ChkDate = DateAdd("d", -7, Date())
| > | > | > | > | ' subtracts 7 days from today
| > | > | > | > | blnActive = True
| > | > | > | > | %>
| > | > | > | > |
| > | > | > | > | I did swap the ChkDate and Active for what they are
| > called in my database,
| > | > | > | > | also the date used is a timestamp which has time and
| > date. then followed the
| > | > | > | > | rest of the instructions.
| > | > | > | > |
| > | > | > | > | but then again if the information was wrong i'd at
| > least think the page
| > | > | > | > | would load up with an error. knowing me i've probably
| > overlooked something
| > | > | > | > | stupid.
| > | > | > | > |
| > | > | > | > | thanks for your help and of course keep up the good
| > work
| > | > | > | > |
| > | > | > | > |
| > | > | > | > | Al....
| > | > | > | > |
| > | > | > | > |
| > | > | > | > | "Stefan B Rusynko" wrote:
| > | > | > | > |
| > | > | > | > | > You can do it in 1 step w/ the DBRW
| > | > | > | > | >
| > | > | > | > | > To find your "aged" date use a new calculated
| > variable (ChkDate) to age your DB date field named as say:
| > DateEdited,
| > and
| > | > | > lets
| > | > | > | > say
| > | > | > | > | > your other field to check is named Active (a
| > True/False DB field if checked = True),
| > | > | > | > | > Set their initial values, by adding at the top of
| > the page in Code view (before any the DBRW code)
| > | > | > | > | >
| > | > | > | > | > <%
| > | > | > | > | > Dim ChkDate, blnActive
| > | > | > | > | > ChkDate = DateAdd("d", -7, Date())
| > | > | > | > | > ' subtracts 7 days from today
| > | > | > | > | > blnActive = True
| > | > | > | > | > %>
| > | > | > | > | >
| > | > | > | > | > Now Edit your DBRW criteria (More Options) to add
| > the Criteria
| > | > | > | > | >
| > | > | > | > | > DatedEdited Less Than ChkDate
 
S

Sproul

In Code vied insert these three lines above the <Head> tag

<%
Dim ChkDate, blnActive
ChkDate = DateAdd("d", -2, Date())
blnActive = "Yes"
%>


changed 7 - 2 to match date of records in database

Back to design Mode

Insert-Database-Results

Database is automatically selected 'Index' -- (Next)
Table is automatically selected 'Results' -- (Next)

(More Options) (Criteria) (add)

Timestamp Less Than ChkDate
And
D1 Equals BlnActive

(ok) (ok) (ok) (next) Untick the three boxes (next)

(Display All Records Together) (Finish)

Remove Column between two yellow columns in table

Go into Code Mode and insert

<p>The Record count is: <%=fp_iCount %></p>

Back to Design mode

Right Click Field next to ChkDate (Form Field Properties)

Insert into inital value

<%=ChkDate%>

(ok)

Right Click Field next to BlnActive (Form Field Properties)

Insert into inital value

<%=blnActive%>

(ok)

Save The page and then publish


Initialy a DBRW error is shown
click submit and the error dissapears and is replaced with
No Records Returned


Any Ideas?.



Al....

Sproul said:
I'm assuming that you have already made this page, and are now pulling out
your hair cause i cant get it, I know that you are only trying to help and i
do appreciate it.

Also i have added the link below to my favourites incase i need to use it at
some point.

What i'm gonna do is delete the page again and start from fresh, i was
actually hoping that it could be done through a custom query.

Anyway i'll do it again, and write down exactly what i did.


Al....

Stefan B Rusynko said:
Good catch
Didn't even check that field name against the reserved ones at http://www.aspfaq.com/show.asp?id=2080

- best to just create a new field in the DB (or rename the existing one) w/ an unreserved name - say EditDate




| You may have to place the Timestamp field in square brackets -
| [Timestamp] - in the grey webbot code. Timestamp is a reserved word.
| --
| Ron Symonds
| Microsoft MVP (FrontPage)
| Reply only to group - emails will be deleted unread.
|
| | > Time in date/time field is not relevant
| > - it still has a date element to which you are adding (- 7) days
| >
| > Don't change your PC date, just change the value of - 7 to whatever
| > # days your data is aged to (0 is today)
| >
| > On a new page make a std DBRW query to see if you get any results
| > showing all DB fields and their values from the DB (look for
| > errors in CaSe or data types and what both Timestamp and D1 return)
| > Then add 1 criteria at a time to see where you are generating a
| > field mismatch or error
| >
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > | > | Ok the page comes up, still shows an error,
| > | In the search field the ChkDate is 7 days previous, Active is yes,
| > when
| > | submit query is clicked no records are show.
| > |
| > | I changed the date on my PC so that the ChkDate would match the
| > date of the
| > | records in the database and still no records found.
| > |
| > | Is there a way to do it by running a custom query, would it be
| > easier if i
| > | added another field with a date which is only dd/mm/yyyy and not
| > having the
| > | time.
| > |
| > | only thing is i don't know how to automatically add the date in a
| > hidden
| > | field.
| > |
| > | I've had a look at some Access query stuff but most of it is
| > pretty vaig, i
| > | suppose i'd ave to fully commit some quality time to it if i am to
| > learn
| > | anything, can you suggest any good books for a beginner to learn
| > from.
| > |
| > |
| > | Al....
| > |
| > | "Stefan B Rusynko" wrote:
| > |
| > | > Repost your new SQL string and criteria
| > | > Did you name the form fields and set their values as per my
| > original post
| > | >
| > | > PS
| > | > for more meaningful DBRW error messages open the hidden folder
| > /_fpclass/ and edit the fpdbrgn1.inc file
| > | >
| > | > At about line 19, change :
| > | > fp_DEBUG = False
| > | > to :
| > | > fp_DEBUG = True
| > | >
| > | >
| > | > --
| > | >
| > | > _____________________________________________
| > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > To find the best Newsgroup for FrontPage support see:
| > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > _____________________________________________
| > | >
| > | >
| > | > | > | Were a step further, the page is at least loading up but
| > there's an error
| > | > |
| > | > | Database Results Wizard Error
| > | > | The operation failed. If this continues, please contact your
| > server
| > | > | administrator.
| > | > |
| > | > | everything matches what you specified
| > | > |
| > | > | i also tried BlnActive = Yes and BlnActive = "Yes" still the
| > same error
| > | > |
| > | > |
| > | > | thanks Al....
| > | > |
| > | > | "Stefan B Rusynko" wrote:
| > | > |
| > | > | > Not quite
| > | > | >
| > | > | > These 3 line of code go in separate lines!
| > | > | > <%
| > | > | > Dim ChkDate, blnActive
| > | > | > ChkDate = DateAdd("d", -7, Date())
| > | > | > blnActive = True
| > | > | > %>
| > | > | >
| > | > | > Note:
| > | > | > You may need to use blnActive = Yes or blnActive = "Yes"
| > because of your field type being yes/no
| > | > | > - recommend instead changing your DB in Access to make the
| > Yes/No field a True/False field
| > | > | >
| > | > | > Add the code at the top of the page in code view (before the
| > <head> tag)
| > | > | > - because if where the DBRW will add the form code
| > | > | >
| > | > | > Set your Criteria to use the new variables - do not set
| > defaults!
| > | > | >
| > | > | > For Criteria set (using an AND)
| > | > | > Timestamp LessThan ChkDate
| > | > | > D1 Equals Active
| > | > | >
| > | > | > Should give you (each of below will be on 1 line)
| > | > | >
| > | > | > fp_sQry="SELECT * FROM Results WHERE (Timestamp <
| > '::ChkDate::' AND D1 = ::Active::)"
| > | > | >
| > | > | > fp_sDefault="ChkDate=&Active="
| > | > | >
| > | > | >
| > | > | > --
| > | > | >
| > | > | > _____________________________________________
| > | > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > | > To find the best Newsgroup for FrontPage support see:
| > | > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > | > _____________________________________________
| > | > | >
| > | > | >
| > | > | > | > | ok, here goes
| > | > | > |
| > | > | > | the time and date field is called Timestamp
| > | > | > | the checked field is called D1 (using test database) with
| > either a yes or no
| > | > | > |
| > | > | > | <% Dim ChkDate, blnActive ChkDate = DateAdd("d", -7,
| > Date()) ' subtracts 7
| > | > | > | days from today blnActive = True %>
| > | > | > |
| > | > | > | the code above was added in above the first grey txt (in
| > FP)
| > | > | > |
| > | > | > | criteria =
| > | > | > | Timestamp LessThan Timestamp
| > | > | > | D1 Equals D1
| > | > | > |
| > | > | > | Defaults =
| > | > | > | Timestamp <%=ChkDate%>
| > | > | > | D1 <%=blnActive%>
| > | > | > |
| > | > | > | code snippets as reqyuested
| > | > | > |
| > | > | > | fp_sQry="SELECT * FROM Results WHERE (Timestamp <
| > '::Timestamp::' AND D1 =
| > | > | > | '::D1::')"
| > | > | > | fp_sDefault="Timestamp=<%=ChkDate%>&D1=<%=blnActive%>"
| > | > | > |
| > | > | > |
| > | > | > | So that you don't think i'm being ignorant it's now time
| > for me to go,
| > | > | > | thanks for your help, i'll check in tomorrow.
| > | > | > |
| > | > | > |
| > | > | > | Al....
| > | > | > | "Stefan B Rusynko" wrote:
| > | > | > |
| > | > | > | > Do not change the new variables ChkDate or blnActive to
| > match your DB field names
| > | > | > | > - they have nothing to do w/ your DB field names (they
| > are variables to compare to)
| > | > | > | >
| > | > | > | > If the date field in your DB is a timestamp (date/time)
| > in your DB it will still work,
| > | > | > | > - what are the Actual field names for the date field
| > (timestamp) and "checked" field
| > | > | > | > - is your "checked" field (for my fictive "Active" field
| > name) a True/False (preferred) or Yes/No field type in Access
| > | > | > | >
| > | > | > | > You would use your field names Only in the DBRW criteria
| > (instead of my fictive fields named DatedEdited and Active) in
| > | > | > | > DatedEdited Less Than ChkDate
| > | > | > | > And
| > | > | > | > Active Equals blnActive
| > | > | > | >
| > | > | > | > Post a snippet of the Sql select you have (from
| > fp_sQry="...." and the names of your table plus the 2 DB field
| > names/types
| > | > | > | > --
| > | > | > | >
| > | > | > | > _____________________________________________
| > | > | > | > SBR @ ENJOY (-: [ Microsoft MVP -
| > FrontPage ]
| > | > | > | > "Warning - Using the F1 Key will not break anything!"
| > (-;
| > | > | > | > To find the best Newsgroup for FrontPage support see:
| > | > | > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > | > | > _____________________________________________
| > | > | > | >
| > | > | > | >
| > message | > | > | > | > | stefan thanks as it looks as though you put a bit of
| > effort into helping me
| > | > | > | > | but unfortunatley it didn't work, the page it's self
| > wont actually load, i'm
| > | > | > | > | not sure if it's the
| > | > | > | > | <%
| > | > | > | > | Dim ChkDate, blnActive
| > | > | > | > | ChkDate = DateAdd("d", -7, Date())
| > | > | > | > | ' subtracts 7 days from today
| > | > | > | > | blnActive = True
| > | > | > | > | %>
| > | > | > | > |
| > | > | > | > | I did swap the ChkDate and Active for what they are
| > called in my database,
| > | > | > | > | also the date used is a timestamp which has time and
| > date. then followed the
| > | > | > | > | rest of the instructions.
| > | > | > | > |
| > | > | > | > | but then again if the information was wrong i'd at
| > least think the page
| > | > | > | > | would load up with an error. knowing me i've probably
| > overlooked something
| > | > | > | > | stupid.
| > | > | > | > |
| > | > | > | > | thanks for your help and of course keep up the good
| > work
| > | > | > | > |
| > | > | > | > |
| > | > | > | > | Al....
| > | > | > | > |
| > | > | > | > |
| > | > | > | > | "Stefan B Rusynko" wrote:
| > | > | > | > |
| > | > | > | > | > You can do it in 1 step w/ the DBRW
| > | > | > | > | >
| > | > | > | > | > To find your "aged" date use a new calculated
| > variable (ChkDate) to age your DB date field named as say:
| > DateEdited,
| > and
| > | > | > lets
 
S

Sproul

Eureka, well not quite but almost

I have taken the BlnActive out of the equation and just set the criteria for
D1 to equal yes.

ChkDate is the date now - 7 therfore if Timestamp is less than ChkDate then
it's looking for records older than 7 days so i have changed this to

Timestamp Greater Than ChkDate
And
D1 Equals D1


the search form defaults are

chkdate = <%=ChkDate%>
D1 = Yes

I also had <p>The Record count is: <%=fp_iCount %></p> in the wrong place
as i had it in the table instead of after the </table> tag

so now it still comes up with an error but if you press submit on the search
box the record count is updated.

so now i just have to get rid of the error, the error is

Description: Parameter ?_1 has no default value.
Number: -2147217904 (0x80040E10)
Source: Microsoft JET Database Engine

One or more form fields were empty. You should provide default values for
all form fields that are used in the query.

Thanks again Al....






Sproul said:
In Code vied insert these three lines above the <Head> tag

<%
Dim ChkDate, blnActive
ChkDate = DateAdd("d", -2, Date())
blnActive = "Yes"
%>


changed 7 - 2 to match date of records in database

Back to design Mode

Insert-Database-Results

Database is automatically selected 'Index' -- (Next)
Table is automatically selected 'Results' -- (Next)

(More Options) (Criteria) (add)

Timestamp Less Than ChkDate
And
D1 Equals BlnActive

(ok) (ok) (ok) (next) Untick the three boxes (next)

(Display All Records Together) (Finish)

Remove Column between two yellow columns in table

Go into Code Mode and insert

<p>The Record count is: <%=fp_iCount %></p>

Back to Design mode

Right Click Field next to ChkDate (Form Field Properties)

Insert into inital value

<%=ChkDate%>

(ok)

Right Click Field next to BlnActive (Form Field Properties)

Insert into inital value

<%=blnActive%>

(ok)

Save The page and then publish


Initialy a DBRW error is shown
click submit and the error dissapears and is replaced with
No Records Returned


Any Ideas?.



Al....

Sproul said:
I'm assuming that you have already made this page, and are now pulling out
your hair cause i cant get it, I know that you are only trying to help and i
do appreciate it.

Also i have added the link below to my favourites incase i need to use it at
some point.

What i'm gonna do is delete the page again and start from fresh, i was
actually hoping that it could be done through a custom query.

Anyway i'll do it again, and write down exactly what i did.


Al....

Stefan B Rusynko said:
Good catch
Didn't even check that field name against the reserved ones at http://www.aspfaq.com/show.asp?id=2080

- best to just create a new field in the DB (or rename the existing one) w/ an unreserved name - say EditDate




| You may have to place the Timestamp field in square brackets -
| [Timestamp] - in the grey webbot code. Timestamp is a reserved word.
| --
| Ron Symonds
| Microsoft MVP (FrontPage)
| Reply only to group - emails will be deleted unread.
|
| | > Time in date/time field is not relevant
| > - it still has a date element to which you are adding (- 7) days
| >
| > Don't change your PC date, just change the value of - 7 to whatever
| > # days your data is aged to (0 is today)
| >
| > On a new page make a std DBRW query to see if you get any results
| > showing all DB fields and their values from the DB (look for
| > errors in CaSe or data types and what both Timestamp and D1 return)
| > Then add 1 criteria at a time to see where you are generating a
| > field mismatch or error
| >
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > | > | Ok the page comes up, still shows an error,
| > | In the search field the ChkDate is 7 days previous, Active is yes,
| > when
| > | submit query is clicked no records are show.
| > |
| > | I changed the date on my PC so that the ChkDate would match the
| > date of the
| > | records in the database and still no records found.
| > |
| > | Is there a way to do it by running a custom query, would it be
| > easier if i
| > | added another field with a date which is only dd/mm/yyyy and not
| > having the
| > | time.
| > |
| > | only thing is i don't know how to automatically add the date in a
| > hidden
| > | field.
| > |
| > | I've had a look at some Access query stuff but most of it is
| > pretty vaig, i
| > | suppose i'd ave to fully commit some quality time to it if i am to
| > learn
| > | anything, can you suggest any good books for a beginner to learn
| > from.
| > |
| > |
| > | Al....
| > |
| > | "Stefan B Rusynko" wrote:
| > |
| > | > Repost your new SQL string and criteria
| > | > Did you name the form fields and set their values as per my
| > original post
| > | >
| > | > PS
| > | > for more meaningful DBRW error messages open the hidden folder
| > /_fpclass/ and edit the fpdbrgn1.inc file
| > | >
| > | > At about line 19, change :
| > | > fp_DEBUG = False
| > | > to :
| > | > fp_DEBUG = True
| > | >
| > | >
| > | > --
| > | >
| > | > _____________________________________________
| > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > To find the best Newsgroup for FrontPage support see:
| > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > _____________________________________________
| > | >
| > | >
| > | > | > | Were a step further, the page is at least loading up but
| > there's an error
| > | > |
| > | > | Database Results Wizard Error
| > | > | The operation failed. If this continues, please contact your
| > server
| > | > | administrator.
| > | > |
| > | > | everything matches what you specified
| > | > |
| > | > | i also tried BlnActive = Yes and BlnActive = "Yes" still the
| > same error
| > | > |
| > | > |
| > | > | thanks Al....
| > | > |
| > | > | "Stefan B Rusynko" wrote:
| > | > |
| > | > | > Not quite
| > | > | >
| > | > | > These 3 line of code go in separate lines!
| > | > | > <%
| > | > | > Dim ChkDate, blnActive
| > | > | > ChkDate = DateAdd("d", -7, Date())
| > | > | > blnActive = True
| > | > | > %>
| > | > | >
| > | > | > Note:
| > | > | > You may need to use blnActive = Yes or blnActive = "Yes"
| > because of your field type being yes/no
| > | > | > - recommend instead changing your DB in Access to make the
| > Yes/No field a True/False field
| > | > | >
| > | > | > Add the code at the top of the page in code view (before the
| > <head> tag)
| > | > | > - because if where the DBRW will add the form code
| > | > | >
| > | > | > Set your Criteria to use the new variables - do not set
| > defaults!
| > | > | >
| > | > | > For Criteria set (using an AND)
| > | > | > Timestamp LessThan ChkDate
| > | > | > D1 Equals Active
| > | > | >
| > | > | > Should give you (each of below will be on 1 line)
| > | > | >
| > | > | > fp_sQry="SELECT * FROM Results WHERE (Timestamp <
| > '::ChkDate::' AND D1 = ::Active::)"
| > | > | >
| > | > | > fp_sDefault="ChkDate=&Active="
| > | > | >
| > | > | >
| > | > | > --
| > | > | >
| > | > | > _____________________________________________
| > | > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > | > To find the best Newsgroup for FrontPage support see:
| > | > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > | > _____________________________________________
| > | > | >
| > | > | >
| > | > | > | > | ok, here goes
| > | > | > |
| > | > | > | the time and date field is called Timestamp
| > | > | > | the checked field is called D1 (using test database) with
| > either a yes or no
| > | > | > |
| > | > | > | <% Dim ChkDate, blnActive ChkDate = DateAdd("d", -7,
| > Date()) ' subtracts 7
| > | > | > | days from today blnActive = True %>
| > | > | > |
| > | > | > | the code above was added in above the first grey txt (in
| > FP)
| > | > | > |
| > | > | > | criteria =
| > | > | > | Timestamp LessThan Timestamp
| > | > | > | D1 Equals D1
| > | > | > |
| > | > | > | Defaults =
| > | > | > | Timestamp <%=ChkDate%>
| > | > | > | D1 <%=blnActive%>
| > | > | > |
| > | > | > | code snippets as reqyuested
| > | > | > |
| > | > | > | fp_sQry="SELECT * FROM Results WHERE (Timestamp <
| > '::Timestamp::' AND D1 =
| > | > | > | '::D1::')"
| > | > | > | fp_sDefault="Timestamp=<%=ChkDate%>&D1=<%=blnActive%>"
| > | > | > |
| > | > | > |
| > | > | > | So that you don't think i'm being ignorant it's now time
| > for me to go,
| > | > | > | thanks for your help, i'll check in tomorrow.
| > | > | > |
| > | > | > |
| > | > | > | Al....
| > | > | > | "Stefan B Rusynko" wrote:
| > | > | > |
| > | > | > | > Do not change the new variables ChkDate or blnActive to
| > match your DB field names
| > | > | > | > - they have nothing to do w/ your DB field names (they
| > are variables to compare to)
| > | > | > | >
| > | > | > | > If the date field in your DB is a timestamp (date/time)
| > in your DB it will still work,
 
S

Stefan B Rusynko

Good

The initial error is because there is no initial value assigned to D1 until you submit the form (which then presumably is sending a
form field named D1 w/ a value of Yes)

The criteria
D1 Equals D1
means the table field D1 is equal to the value of some variable named D1
(which it does not have until you run the form)

Since the D1 variable is a constant, - always = Yes,
Try changing the 2nd criteria to
D1 Equals Yes
and selecting the option on criteria to Not use a Search form field for that criteria
- you may need to use = "Yes" or = Yes or <> 0 depending on your D1 field type
- you can delete the ASP code for line blnActive = "Yes"

PS
Test by leaving the DBRW detail results row (not column) showing to see what fieldnames and actual values of fields are returned
1) std DBRW w/o any criteria (to see all results and data types)
2) add a criteria for D1 (w/ and then w/o a form search form option)
3) add a criteria for your new DB date comparison fieldname < ChkDate
4) only at that point delete the display Row between the two yellow DBRW message rows





| Eureka, well not quite but almost
|
| I have taken the BlnActive out of the equation and just set the criteria for
| D1 to equal yes.
|
| ChkDate is the date now - 7 therfore if Timestamp is less than ChkDate then
| it's looking for records older than 7 days so i have changed this to
|
| Timestamp Greater Than ChkDate
| And
| D1 Equals D1
|
|
| the search form defaults are
|
| chkdate = <%=ChkDate%>
| D1 = Yes
|
| I also had <p>The Record count is: <%=fp_iCount %></p> in the wrong place
| as i had it in the table instead of after the </table> tag
|
| so now it still comes up with an error but if you press submit on the search
| box the record count is updated.
|
| so now i just have to get rid of the error, the error is
|
| Description: Parameter ?_1 has no default value.
| Number: -2147217904 (0x80040E10)
| Source: Microsoft JET Database Engine
|
| One or more form fields were empty. You should provide default values for
| all form fields that are used in the query.
|
| Thanks again Al....
|
|
|
|
|
|
| "Sproul" wrote:
|
| > In Code vied insert these three lines above the <Head> tag
| >
| > <%
| > Dim ChkDate, blnActive
| > ChkDate = DateAdd("d", -2, Date())
| > blnActive = "Yes"
| > %>
| >
| >
| > changed 7 - 2 to match date of records in database
| >
| > Back to design Mode
| >
| > Insert-Database-Results
| >
| > Database is automatically selected 'Index' -- (Next)
| > Table is automatically selected 'Results' -- (Next)
| >
| > (More Options) (Criteria) (add)
| >
| > Timestamp Less Than ChkDate
| > And
| > D1 Equals BlnActive
| >
| > (ok) (ok) (ok) (next) Untick the three boxes (next)
| >
| > (Display All Records Together) (Finish)
| >
| > Remove Column between two yellow columns in table
| >
| > Go into Code Mode and insert
| >
| > <p>The Record count is: <%=fp_iCount %></p>
| >
| > Back to Design mode
| >
| > Right Click Field next to ChkDate (Form Field Properties)
| >
| > Insert into inital value
| >
| > <%=ChkDate%>
| >
| > (ok)
| >
| > Right Click Field next to BlnActive (Form Field Properties)
| >
| > Insert into inital value
| >
| > <%=blnActive%>
| >
| > (ok)
| >
| > Save The page and then publish
| >
| >
| > Initialy a DBRW error is shown
| > click submit and the error dissapears and is replaced with
| > No Records Returned
| >
| >
| > Any Ideas?.
| >
| >
| >
| > Al....
| >
| > "Sproul" wrote:
| >
| > > I'm assuming that you have already made this page, and are now pulling out
| > > your hair cause i cant get it, I know that you are only trying to help and i
| > > do appreciate it.
| > >
| > > Also i have added the link below to my favourites incase i need to use it at
| > > some point.
| > >
| > > What i'm gonna do is delete the page again and start from fresh, i was
| > > actually hoping that it could be done through a custom query.
| > >
| > > Anyway i'll do it again, and write down exactly what i did.
| > >
| > >
| > > Al....
| > >
| > > "Stefan B Rusynko" wrote:
| > >
| > > > Good catch
| > > > Didn't even check that field name against the reserved ones at http://www.aspfaq.com/show.asp?id=2080
| > > >
| > > > - best to just create a new field in the DB (or rename the existing one) w/ an unreserved name - say EditDate
| > > >
| > > > --
| > > >
| > > > _____________________________________________
| > > > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > > > "Warning - Using the F1 Key will not break anything!" (-;
| > > > To find the best Newsgroup for FrontPage support see:
| > > > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > > > _____________________________________________
| > > >
| > > >
| > > > | You may have to place the Timestamp field in square brackets -
| > > > | [Timestamp] - in the grey webbot code. Timestamp is a reserved word.
| > > > | --
| > > > | Ron Symonds
| > > > | Microsoft MVP (FrontPage)
| > > > | Reply only to group - emails will be deleted unread.
| > > > |
| > > > | | > > > | > Time in date/time field is not relevant
| > > > | > - it still has a date element to which you are adding (- 7) days
| > > > | >
| > > > | > Don't change your PC date, just change the value of - 7 to whatever
| > > > | > # days your data is aged to (0 is today)
| > > > | >
| > > > | > On a new page make a std DBRW query to see if you get any results
| > > > | > showing all DB fields and their values from the DB (look for
| > > > | > errors in CaSe or data types and what both Timestamp and D1 return)
| > > > | > Then add 1 criteria at a time to see where you are generating a
| > > > | > field mismatch or error
| > > > | >
| > > > | >
| > > > | > --
| > > > | >
| > > > | > _____________________________________________
| > > > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > > > | > "Warning - Using the F1 Key will not break anything!" (-;
| > > > | > To find the best Newsgroup for FrontPage support see:
| > > > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > > > | > _____________________________________________
| > > > | >
| > > > | >
| > > > | > | > > > | > | Ok the page comes up, still shows an error,
| > > > | > | In the search field the ChkDate is 7 days previous, Active is yes,
| > > > | > when
| > > > | > | submit query is clicked no records are show.
| > > > | > |
| > > > | > | I changed the date on my PC so that the ChkDate would match the
| > > > | > date of the
| > > > | > | records in the database and still no records found.
| > > > | > |
| > > > | > | Is there a way to do it by running a custom query, would it be
| > > > | > easier if i
| > > > | > | added another field with a date which is only dd/mm/yyyy and not
| > > > | > having the
| > > > | > | time.
| > > > | > |
| > > > | > | only thing is i don't know how to automatically add the date in a
| > > > | > hidden
| > > > | > | field.
| > > > | > |
| > > > | > | I've had a look at some Access query stuff but most of it is
| > > > | > pretty vaig, i
| > > > | > | suppose i'd ave to fully commit some quality time to it if i am to
| > > > | > learn
| > > > | > | anything, can you suggest any good books for a beginner to learn
| > > > | > from.
| > > > | > |
| > > > | > |
| > > > | > | Al....
| > > > | > |
| > > > | > | "Stefan B Rusynko" wrote:
| > > > | > |
| > > > | > | > Repost your new SQL string and criteria
| > > > | > | > Did you name the form fields and set their values as per my
| > > > | > original post
| > > > | > | >
| > > > | > | > PS
| > > > | > | > for more meaningful DBRW error messages open the hidden folder
| > > > | > /_fpclass/ and edit the fpdbrgn1.inc file
| > > > | > | >
| > > > | > | > At about line 19, change :
| > > > | > | > fp_DEBUG = False
| > > > | > | > to :
| > > > | > | > fp_DEBUG = True
| > > > | > | >
| > > > | > | >
| > > > | > | > --
| > > > | > | >
| > > > | > | > _____________________________________________
| > > > | > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > > > | > | > "Warning - Using the F1 Key will not break anything!" (-;
| > > > | > | > To find the best Newsgroup for FrontPage support see:
| > > > | > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > > > | > | > _____________________________________________
| > > > | > | >
| > > > | > | >
| > > > | > | > > > | > | > | Were a step further, the page is at least loading up but
| > > > | > there's an error
| > > > | > | > |
| > > > | > | > | Database Results Wizard Error
| > > > | > | > | The operation failed. If this continues, please contact your
| > > > | > server
| > > > | > | > | administrator.
| > > > | > | > |
| > > > | > | > | everything matches what you specified
| > > > | > | > |
| > > > | > | > | i also tried BlnActive = Yes and BlnActive = "Yes" still the
| > > > | > same error
| > > > | > | > |
| > > > | > | > |
| > > > | > | > | thanks Al....
| > > > | > | > |
| > > > | > | > | "Stefan B Rusynko" wrote:
| > > > | > | > |
| > > > | > | > | > Not quite
| > > > | > | > | >
| > > > | > | > | > These 3 line of code go in separate lines!
| > > > | > | > | > <%
| > > > | > | > | > Dim ChkDate, blnActive
| > > > | > | > | > ChkDate = DateAdd("d", -7, Date())
| > > > | > | > | > blnActive = True
| > > > | > | > | > %>
| > > > | > | > | >
| > > > | > | > | > Note:
| > > > | > | > | > You may need to use blnActive = Yes or blnActive = "Yes"
| > > > | > because of your field type being yes/no
| > > > | > | > | > - recommend instead changing your DB in Access to make the
| > > > | > Yes/No field a True/False field
| > > > | > | > | >
| > > > | > | > | > Add the code at the top of the page in code view (before the
| > > > | > <head> tag)
| > > > | > | > | > - because if where the DBRW will add the form code
| > > > | > | > | >
| > > > | > | > | > Set your Criteria to use the new variables - do not set
| > > > | > defaults!
| > > > | > | > | >
| > > > | > | > | > For Criteria set (using an AND)
| > > > | > | > | > Timestamp LessThan ChkDate
| > > > | > | > | > D1 Equals Active
| > > > | > | > | >
| > > > | > | > | > Should give you (each of below will be on 1 line)
| > > > | > | > | >
| > > > | > | > | > fp_sQry="SELECT * FROM Results WHERE (Timestamp <
| > > > | > '::ChkDate::' AND D1 = ::Active::)"
| > > > | > | > | >
| > > > | > | > | > fp_sDefault="ChkDate=&Active="
| > > > | > | > | >
| > > > | > | > | >
| > > > | > | > | > --
| > > > | > | > | >
| > > > | > | > | > _____________________________________________
| > > > | > | > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > > > | > | > | > "Warning - Using the F1 Key will not break anything!" (-;
| > > > | > | > | > To find the best Newsgroup for FrontPage support see:
| > > > | > | > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > > > | > | > | > _____________________________________________
| > > > | > | > | >
| > > > | > | > | >
| > > > | > | > > > | > | > | > | ok, here goes
| > > > | > | > | > |
| > > > | > | > | > | the time and date field is called Timestamp
| > > > | > | > | > | the checked field is called D1 (using test database) with
| > > > | > either a yes or no
| > > > | > | > | > |
| > > > | > | > | > | <% Dim ChkDate, blnActive ChkDate = DateAdd("d", -7,
| > > > | > Date()) ' subtracts 7
| > > > | > | > | > | days from today blnActive = True %>
| > > > | > | > | > |
| > > > | > | > | > | the code above was added in above the first grey txt (in
| > > > | > FP)
| > > > | > | > | > |
| > > > | > | > | > | criteria =
| > > > | > | > | > | Timestamp LessThan Timestamp
| > > > | > | > | > | D1 Equals D1
| > > > | > | > | > |
| > > > | > | > | > | Defaults =
| > > > | > | > | > | Timestamp <%=ChkDate%>
| > > > | > | > | > | D1 <%=blnActive%>
| > > > | > | > | > |
| > > > | > | > | > | code snippets as reqyuested
| > > > | > | > | > |
| > > > | > | > | > | fp_sQry="SELECT * FROM Results WHERE (Timestamp <
| > > > | > '::Timestamp::' AND D1 =
| > > > | > | > | > | '::D1::')"
| > > > | > | > | > | fp_sDefault="Timestamp=<%=ChkDate%>&D1=<%=blnActive%>"
| > > > | > | > | > |
| > > > | > | > | > |
| > > > | > | > | > | So that you don't think i'm being ignorant it's now time
| > > > | > for me to go,
| > > > | > | > | > | thanks for your help, i'll check in tomorrow.
| > > > | > | > | > |
| > > > | > | > | > |
| > > > | > | > | > | Al....
| > > > | > | > | > | "Stefan B Rusynko" wrote:
| > > > | > | > | > |
| > > > | > | > | > | > Do not change the new variables ChkDate or blnActive to
| > > > | > match your DB field names
| > > > | > | > | > | > - they have nothing to do w/ your DB field names (they
| > > > | > are variables to compare to)
| > > > | > | > | > | >
| > > > | > | > | > | > If the date field in your DB is a timestamp (date/time)
| > > > | > in your DB it will still work,
 
S

Sproul

ok i'll give it a go, just another thing to throw the spanner in the works,
whet if i wanted to make the number of days viewed variable, would that be
possible or am i just taking it too far now.

Stefan B Rusynko said:
Good

The initial error is because there is no initial value assigned to D1 until you submit the form (which then presumably is sending a
form field named D1 w/ a value of Yes)

The criteria
D1 Equals D1
means the table field D1 is equal to the value of some variable named D1
(which it does not have until you run the form)

Since the D1 variable is a constant, - always = Yes,
Try changing the 2nd criteria to
D1 Equals Yes
and selecting the option on criteria to Not use a Search form field for that criteria
- you may need to use = "Yes" or = Yes or <> 0 depending on your D1 field type
- you can delete the ASP code for line blnActive = "Yes"

PS
Test by leaving the DBRW detail results row (not column) showing to see what fieldnames and actual values of fields are returned
1) std DBRW w/o any criteria (to see all results and data types)
2) add a criteria for D1 (w/ and then w/o a form search form option)
3) add a criteria for your new DB date comparison fieldname < ChkDate
4) only at that point delete the display Row between the two yellow DBRW message rows





| Eureka, well not quite but almost
|
| I have taken the BlnActive out of the equation and just set the criteria for
| D1 to equal yes.
|
| ChkDate is the date now - 7 therfore if Timestamp is less than ChkDate then
| it's looking for records older than 7 days so i have changed this to
|
| Timestamp Greater Than ChkDate
| And
| D1 Equals D1
|
|
| the search form defaults are
|
| chkdate = <%=ChkDate%>
| D1 = Yes
|
| I also had <p>The Record count is: <%=fp_iCount %></p> in the wrong place
| as i had it in the table instead of after the </table> tag
|
| so now it still comes up with an error but if you press submit on the search
| box the record count is updated.
|
| so now i just have to get rid of the error, the error is
|
| Description: Parameter ?_1 has no default value.
| Number: -2147217904 (0x80040E10)
| Source: Microsoft JET Database Engine
|
| One or more form fields were empty. You should provide default values for
| all form fields that are used in the query.
|
| Thanks again Al....
|
|
|
|
|
|
| "Sproul" wrote:
|
| > In Code vied insert these three lines above the <Head> tag
| >
| > <%
| > Dim ChkDate, blnActive
| > ChkDate = DateAdd("d", -2, Date())
| > blnActive = "Yes"
| > %>
| >
| >
| > changed 7 - 2 to match date of records in database
| >
| > Back to design Mode
| >
| > Insert-Database-Results
| >
| > Database is automatically selected 'Index' -- (Next)
| > Table is automatically selected 'Results' -- (Next)
| >
| > (More Options) (Criteria) (add)
| >
| > Timestamp Less Than ChkDate
| > And
| > D1 Equals BlnActive
| >
| > (ok) (ok) (ok) (next) Untick the three boxes (next)
| >
| > (Display All Records Together) (Finish)
| >
| > Remove Column between two yellow columns in table
| >
| > Go into Code Mode and insert
| >
| > <p>The Record count is: <%=fp_iCount %></p>
| >
| > Back to Design mode
| >
| > Right Click Field next to ChkDate (Form Field Properties)
| >
| > Insert into inital value
| >
| > <%=ChkDate%>
| >
| > (ok)
| >
| > Right Click Field next to BlnActive (Form Field Properties)
| >
| > Insert into inital value
| >
| > <%=blnActive%>
| >
| > (ok)
| >
| > Save The page and then publish
| >
| >
| > Initialy a DBRW error is shown
| > click submit and the error dissapears and is replaced with
| > No Records Returned
| >
| >
| > Any Ideas?.
| >
| >
| >
| > Al....
| >
| > "Sproul" wrote:
| >
| > > I'm assuming that you have already made this page, and are now pulling out
| > > your hair cause i cant get it, I know that you are only trying to help and i
| > > do appreciate it.
| > >
| > > Also i have added the link below to my favourites incase i need to use it at
| > > some point.
| > >
| > > What i'm gonna do is delete the page again and start from fresh, i was
| > > actually hoping that it could be done through a custom query.
| > >
| > > Anyway i'll do it again, and write down exactly what i did.
| > >
| > >
| > > Al....
| > >
| > > "Stefan B Rusynko" wrote:
| > >
| > > > Good catch
| > > > Didn't even check that field name against the reserved ones at http://www.aspfaq.com/show.asp?id=2080
| > > >
| > > > - best to just create a new field in the DB (or rename the existing one) w/ an unreserved name - say EditDate
| > > >
| > > > --
| > > >
| > > > _____________________________________________
| > > > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > > > "Warning - Using the F1 Key will not break anything!" (-;
| > > > To find the best Newsgroup for FrontPage support see:
| > > > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > > > _____________________________________________
| > > >
| > > >
| > > > | You may have to place the Timestamp field in square brackets -
| > > > | [Timestamp] - in the grey webbot code. Timestamp is a reserved word.
| > > > | --
| > > > | Ron Symonds
| > > > | Microsoft MVP (FrontPage)
| > > > | Reply only to group - emails will be deleted unread.
| > > > |
| > > > | | > > > | > Time in date/time field is not relevant
| > > > | > - it still has a date element to which you are adding (- 7) days
| > > > | >
| > > > | > Don't change your PC date, just change the value of - 7 to whatever
| > > > | > # days your data is aged to (0 is today)
| > > > | >
| > > > | > On a new page make a std DBRW query to see if you get any results
| > > > | > showing all DB fields and their values from the DB (look for
| > > > | > errors in CaSe or data types and what both Timestamp and D1 return)
| > > > | > Then add 1 criteria at a time to see where you are generating a
| > > > | > field mismatch or error
| > > > | >
| > > > | >
| > > > | > --
| > > > | >
| > > > | > _____________________________________________
| > > > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > > > | > "Warning - Using the F1 Key will not break anything!" (-;
| > > > | > To find the best Newsgroup for FrontPage support see:
| > > > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > > > | > _____________________________________________
| > > > | >
| > > > | >
| > > > | > | > > > | > | Ok the page comes up, still shows an error,
| > > > | > | In the search field the ChkDate is 7 days previous, Active is yes,
| > > > | > when
| > > > | > | submit query is clicked no records are show.
| > > > | > |
| > > > | > | I changed the date on my PC so that the ChkDate would match the
| > > > | > date of the
| > > > | > | records in the database and still no records found.
| > > > | > |
| > > > | > | Is there a way to do it by running a custom query, would it be
| > > > | > easier if i
| > > > | > | added another field with a date which is only dd/mm/yyyy and not
| > > > | > having the
| > > > | > | time.
| > > > | > |
| > > > | > | only thing is i don't know how to automatically add the date in a
| > > > | > hidden
| > > > | > | field.
| > > > | > |
| > > > | > | I've had a look at some Access query stuff but most of it is
| > > > | > pretty vaig, i
| > > > | > | suppose i'd ave to fully commit some quality time to it if i am to
| > > > | > learn
| > > > | > | anything, can you suggest any good books for a beginner to learn
| > > > | > from.
| > > > | > |
| > > > | > |
| > > > | > | Al....
| > > > | > |
| > > > | > | "Stefan B Rusynko" wrote:
| > > > | > |
| > > > | > | > Repost your new SQL string and criteria
| > > > | > | > Did you name the form fields and set their values as per my
| > > > | > original post
| > > > | > | >
| > > > | > | > PS
| > > > | > | > for more meaningful DBRW error messages open the hidden folder
| > > > | > /_fpclass/ and edit the fpdbrgn1.inc file
| > > > | > | >
| > > > | > | > At about line 19, change :
| > > > | > | > fp_DEBUG = False
| > > > | > | > to :
| > > > | > | > fp_DEBUG = True
| > > > | > | >
| > > > | > | >
| > > > | > | > --
| > > > | > | >
| > > > | > | > _____________________________________________
| > > > | > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > > > | > | > "Warning - Using the F1 Key will not break anything!" (-;
| > > > | > | > To find the best Newsgroup for FrontPage support see:
| > > > | > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > > > | > | > _____________________________________________
| > > > | > | >
| > > > | > | >
| > > > | > | > > > | > | > | Were a step further, the page is at least loading up but
| > > > | > there's an error
| > > > | > | > |
| > > > | > | > | Database Results Wizard Error
| > > > | > | > | The operation failed. If this continues, please contact your
| > > > | > server
| > > > | > | > | administrator.
| > > > | > | > |
| > > > | > | > | everything matches what you specified
| > > > | > | > |
| > > > | > | > | i also tried BlnActive = Yes and BlnActive = "Yes" still the
| > > > | > same error
| > > > | > | > |
| > > > | > | > |
| > > > | > | > | thanks Al....
| > > > | > | > |
| > > > | > | > | "Stefan B Rusynko" wrote:
| > > > | > | > |
| > > > | > | > | > Not quite
| > > > | > | > | >
| > > > | > | > | > These 3 line of code go in separate lines!
| > > > | > | > | > <%
| > > > | > | > | > Dim ChkDate, blnActive
| > > > | > | > | > ChkDate = DateAdd("d", -7, Date())
| > > > | > | > | > blnActive = True
| > > > | > | > | > %>
| > > > | > | > | >
| > > > | > | > | > Note:
| > > > | > | > | > You may need to use blnActive = Yes or blnActive = "Yes"
| > > > | > because of your field type being yes/no
 
S

Sproul

I managed to get this working

SELECT COUNT(*) AS Recordcount FROM table WHEREdatediff('d', CreatedDate,
Date()) < 7

table was changed to Results
CreatedDate was changed to Timestamp <---i never done this the last time
there should have been a space between WHERE and Datediff <--- i never noticed

Now it works i need to be able to make the days variable if possible but
still have a default value of 7

I'm assuming that would be done with a TXT input but not quite sure how.

Al....
 
S

Stefan B Rusynko

Best done w/ a separate DBRW page that just user two criteria form fields w/ the dates to be spanned ( < and >) entered in the 2
form fields
- if it is just 1 date to age, change the default date value in the form field you have and hit submit query



| ok i'll give it a go, just another thing to throw the spanner in the works,
| whet if i wanted to make the number of days viewed variable, would that be
| possible or am i just taking it too far now.
|
| "Stefan B Rusynko" wrote:
|
| > Good
| >
| > The initial error is because there is no initial value assigned to D1 until you submit the form (which then presumably is
sending a
| > form field named D1 w/ a value of Yes)
| >
| > The criteria
| > D1 Equals D1
| > means the table field D1 is equal to the value of some variable named D1
| > (which it does not have until you run the form)
| >
| > Since the D1 variable is a constant, - always = Yes,
| > Try changing the 2nd criteria to
| > D1 Equals Yes
| > and selecting the option on criteria to Not use a Search form field for that criteria
| > - you may need to use = "Yes" or = Yes or <> 0 depending on your D1 field type
| > - you can delete the ASP code for line blnActive = "Yes"
| >
| > PS
| > Test by leaving the DBRW detail results row (not column) showing to see what fieldnames and actual values of fields are returned
| > 1) std DBRW w/o any criteria (to see all results and data types)
| > 2) add a criteria for D1 (w/ and then w/o a form search form option)
| > 3) add a criteria for your new DB date comparison fieldname < ChkDate
| > 4) only at that point delete the display Row between the two yellow DBRW message rows
| >
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > | Eureka, well not quite but almost
| > |
| > | I have taken the BlnActive out of the equation and just set the criteria for
| > | D1 to equal yes.
| > |
| > | ChkDate is the date now - 7 therfore if Timestamp is less than ChkDate then
| > | it's looking for records older than 7 days so i have changed this to
| > |
| > | Timestamp Greater Than ChkDate
| > | And
| > | D1 Equals D1
| > |
| > |
| > | the search form defaults are
| > |
| > | chkdate = <%=ChkDate%>
| > | D1 = Yes
| > |
| > | I also had <p>The Record count is: <%=fp_iCount %></p> in the wrong place
| > | as i had it in the table instead of after the </table> tag
| > |
| > | so now it still comes up with an error but if you press submit on the search
| > | box the record count is updated.
| > |
| > | so now i just have to get rid of the error, the error is
| > |
| > | Description: Parameter ?_1 has no default value.
| > | Number: -2147217904 (0x80040E10)
| > | Source: Microsoft JET Database Engine
| > |
| > | One or more form fields were empty. You should provide default values for
| > | all form fields that are used in the query.
| > |
| > | Thanks again Al....
| > |
| > |
| > |
| > |
| > |
| > |
| > | "Sproul" wrote:
| > |
| > | > In Code vied insert these three lines above the <Head> tag
| > | >
| > | > <%
| > | > Dim ChkDate, blnActive
| > | > ChkDate = DateAdd("d", -2, Date())
| > | > blnActive = "Yes"
| > | > %>
| > | >
| > | >
| > | > changed 7 - 2 to match date of records in database
| > | >
| > | > Back to design Mode
| > | >
| > | > Insert-Database-Results
| > | >
| > | > Database is automatically selected 'Index' -- (Next)
| > | > Table is automatically selected 'Results' -- (Next)
| > | >
| > | > (More Options) (Criteria) (add)
| > | >
| > | > Timestamp Less Than ChkDate
| > | > And
| > | > D1 Equals BlnActive
| > | >
| > | > (ok) (ok) (ok) (next) Untick the three boxes (next)
| > | >
| > | > (Display All Records Together) (Finish)
| > | >
| > | > Remove Column between two yellow columns in table
| > | >
| > | > Go into Code Mode and insert
| > | >
| > | > <p>The Record count is: <%=fp_iCount %></p>
| > | >
| > | > Back to Design mode
| > | >
| > | > Right Click Field next to ChkDate (Form Field Properties)
| > | >
| > | > Insert into inital value
| > | >
| > | > <%=ChkDate%>
| > | >
| > | > (ok)
| > | >
| > | > Right Click Field next to BlnActive (Form Field Properties)
| > | >
| > | > Insert into inital value
| > | >
| > | > <%=blnActive%>
| > | >
| > | > (ok)
| > | >
| > | > Save The page and then publish
| > | >
| > | >
| > | > Initialy a DBRW error is shown
| > | > click submit and the error dissapears and is replaced with
| > | > No Records Returned
| > | >
| > | >
| > | > Any Ideas?.
| > | >
| > | >
| > | >
| > | > Al....
| > | >
| > | > "Sproul" wrote:
| > | >
| > | > > I'm assuming that you have already made this page, and are now pulling out
| > | > > your hair cause i cant get it, I know that you are only trying to help and i
| > | > > do appreciate it.
| > | > >
| > | > > Also i have added the link below to my favourites incase i need to use it at
| > | > > some point.
| > | > >
| > | > > What i'm gonna do is delete the page again and start from fresh, i was
| > | > > actually hoping that it could be done through a custom query.
| > | > >
| > | > > Anyway i'll do it again, and write down exactly what i did.
| > | > >
| > | > >
| > | > > Al....
| > | > >
| > | > > "Stefan B Rusynko" wrote:
| > | > >
| > | > > > Good catch
| > | > > > Didn't even check that field name against the reserved ones at http://www.aspfaq.com/show.asp?id=2080
| > | > > >
| > | > > > - best to just create a new field in the DB (or rename the existing one) w/ an unreserved name - say EditDate
| > | > > >
| > | > > > --
| > | > > >
| > | > > > _____________________________________________
| > | > > > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > > > "Warning - Using the F1 Key will not break anything!" (-;
| > | > > > To find the best Newsgroup for FrontPage support see:
| > | > > > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > > > _____________________________________________
| > | > > >
| > | > > >
| > | > > > | You may have to place the Timestamp field in square brackets -
| > | > > > | [Timestamp] - in the grey webbot code. Timestamp is a reserved word.
| > | > > > | --
| > | > > > | Ron Symonds
| > | > > > | Microsoft MVP (FrontPage)
| > | > > > | Reply only to group - emails will be deleted unread.
| > | > > > |
| > | > > > | | > | > > > | > Time in date/time field is not relevant
| > | > > > | > - it still has a date element to which you are adding (- 7) days
| > | > > > | >
| > | > > > | > Don't change your PC date, just change the value of - 7 to whatever
| > | > > > | > # days your data is aged to (0 is today)
| > | > > > | >
| > | > > > | > On a new page make a std DBRW query to see if you get any results
| > | > > > | > showing all DB fields and their values from the DB (look for
| > | > > > | > errors in CaSe or data types and what both Timestamp and D1 return)
| > | > > > | > Then add 1 criteria at a time to see where you are generating a
| > | > > > | > field mismatch or error
| > | > > > | >
| > | > > > | >
| > | > > > | > --
| > | > > > | >
| > | > > > | > _____________________________________________
| > | > > > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > > > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > > > | > To find the best Newsgroup for FrontPage support see:
| > | > > > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > > > | > _____________________________________________
| > | > > > | >
| > | > > > | >
| > | > > > | > | > | > > > | > | Ok the page comes up, still shows an error,
| > | > > > | > | In the search field the ChkDate is 7 days previous, Active is yes,
| > | > > > | > when
| > | > > > | > | submit query is clicked no records are show.
| > | > > > | > |
| > | > > > | > | I changed the date on my PC so that the ChkDate would match the
| > | > > > | > date of the
| > | > > > | > | records in the database and still no records found.
| > | > > > | > |
| > | > > > | > | Is there a way to do it by running a custom query, would it be
| > | > > > | > easier if i
| > | > > > | > | added another field with a date which is only dd/mm/yyyy and not
| > | > > > | > having the
| > | > > > | > | time.
| > | > > > | > |
| > | > > > | > | only thing is i don't know how to automatically add the date in a
| > | > > > | > hidden
| > | > > > | > | field.
| > | > > > | > |
| > | > > > | > | I've had a look at some Access query stuff but most of it is
| > | > > > | > pretty vaig, i
| > | > > > | > | suppose i'd ave to fully commit some quality time to it if i am to
| > | > > > | > learn
| > | > > > | > | anything, can you suggest any good books for a beginner to learn
| > | > > > | > from.
| > | > > > | > |
| > | > > > | > |
| > | > > > | > | Al....
| > | > > > | > |
| > | > > > | > | "Stefan B Rusynko" wrote:
| > | > > > | > |
| > | > > > | > | > Repost your new SQL string and criteria
| > | > > > | > | > Did you name the form fields and set their values as per my
| > | > > > | > original post
| > | > > > | > | >
| > | > > > | > | > PS
| > | > > > | > | > for more meaningful DBRW error messages open the hidden folder
| > | > > > | > /_fpclass/ and edit the fpdbrgn1.inc file
| > | > > > | > | >
| > | > > > | > | > At about line 19, change :
| > | > > > | > | > fp_DEBUG = False
| > | > > > | > | > to :
| > | > > > | > | > fp_DEBUG = True
| > | > > > | > | >
| > | > > > | > | >
| > | > > > | > | > --
| > | > > > | > | >
| > | > > > | > | > _____________________________________________
| > | > > > | > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > > > | > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > > > | > | > To find the best Newsgroup for FrontPage support see:
| > | > > > | > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > > > | > | > _____________________________________________
| > | > > > | > | >
| > | > > > | > | >
| > | > > > | > | > | > > > | > | > | Were a step further, the page is at least loading up but
| > | > > > | > there's an error
| > | > > > | > | > |
| > | > > > | > | > | Database Results Wizard Error
| > | > > > | > | > | The operation failed. If this continues, please contact your
| > | > > > | > server
| > | > > > | > | > | administrator.
| > | > > > | > | > |
| > | > > > | > | > | everything matches what you specified
| > | > > > | > | > |
| > | > > > | > | > | i also tried BlnActive = Yes and BlnActive = "Yes" still the
| > | > > > | > same error
| > | > > > | > | > |
| > | > > > | > | > |
| > | > > > | > | > | thanks Al....
| > | > > > | > | > |
| > | > > > | > | > | "Stefan B Rusynko" wrote:
| > | > > > | > | > |
| > | > > > | > | > | > Not quite
| > | > > > | > | > | >
| > | > > > | > | > | > These 3 line of code go in separate lines!
| > | > > > | > | > | > <%
| > | > > > | > | > | > Dim ChkDate, blnActive
| > | > > > | > | > | > ChkDate = DateAdd("d", -7, Date())
| > | > > > | > | > | > blnActive = True
| > | > > > | > | > | > %>
| > | > > > | > | > | >
| > | > > > | > | > | > Note:
| > | > > > | > | > | > You may need to use blnActive = Yes or blnActive = "Yes"
| > | > > > | > because of your field type being yes/no
 
S

Stefan B Rusynko

See other response

For your specific select add a form field (say NoDays, default value = 7) and get its value

<%
NoDays = Cint(Request.Form("NoDays")
%>

Then

SELECT COUNT(*) AS Recordcount FROM table WHEREdatediff('d', CreatedDate, Date()) < NoDays




|I managed to get this working
|
| SELECT COUNT(*) AS Recordcount FROM table WHEREdatediff('d', CreatedDate,
| Date()) < 7
|
| table was changed to Results
| CreatedDate was changed to Timestamp <---i never done this the last time
| there should have been a space between WHERE and Datediff <--- i never noticed
|
| Now it works i need to be able to make the days variable if possible but
| still have a default value of 7
|
| I'm assuming that would be done with a TXT input but not quite sure how.
|
| Al....
|
| "Sproul" wrote:
|
| > Jon just to say that i tried just using "SELECT COUNT(*) AS Recordcount FROM
| > Results" and this returned a record count (as you probably already knew) i'd
| > been trying to do this for a few days.
| >
| > then i edited the other line you gave me and came out with this "SELECT
| > COUNT(*) AS Recordcount FROM Results WHERE (D1 = 'yes')" and this returned a
| > count of the records with yes
| >
| > so now i'm about half way there, just need to get the search done within the
| > last 7 days.
| >
| > So thanks jon
| >
| > it would probably be better if i got myself a book on this, can you tell me
| > what language is used (i'm assuming SQL)
| >
| > once again thanks, and keep up the good work
| >
| > "Jon Spivey" wrote:
| >
| > > Hi,
| > >
| > > You'd probably find this easier to do with 2 database results.
| > > 1/ For the record count use a custom query ike this
| > > SELECT COUNT(*) AS Recordcount
| > > FROM table WHEREdatediff('d', CreatedDate, Date()) < 7
| > > 2/ To display
| > > SELECT *, 'Yes' AS Yes
| > > FROM table WHEREdatediff('d', CreatedDate, Date()) < 7
| > >
| > > --
| > > Cheers,
| > > Jon
| > > Microsoft MVP
| > >
| > > | > > > I've got a database setup, i want to be able to count the number of
| > > > records
| > > > created within the last seven days and retunr only the number, next i need
| > > > to
| > > > look ath those records created and return the number of records with a yes
| > > > in
| > > > a specified column.
| > > >
| > > > Just to say i'm new to this but would like to learn more if anyone know's
| > > > any websites i can get usefull free information from.
| > > >
| > > > Al....
| > >
| > >
| > >
 
S

Sproul

adding the lines

<%
NoDays = Cint(Request.Form("NoDays")
%>

caused the page to not load at all, this is getting me stressed now, i think
i'm gonna have to leave it for a few days.

thanks for your help i'll tune in on monday

Al....
 
S

Sproul

i know i said i was leaving it, but it's annoying me that it's not working

The page not opening was because
<%
NoDays = Cint(Request.Form("NoDays")
%>

had a ) missing so should be

<%
NoDays = Cint(Request.Form("NoDays"))
%>

page now loads up but the variable is not passed at all

I think i'm gonna cry


Al....
 
M

MikeR

How did you determine it's not being passed? Did you add it to the form as Stefan
directed? Put the 2 response lines in:
<%
response.write request.form
response.end
NoDays = Cint(Request.Form("NoDays"))
%>
and see what is being passed. If it really is not there, then go back to the form which
is submitting to this page, and re-check how/if NoDays is being populated.
MikeR 1st
 
S

Stefan B Rusynko

Sorry
- my typo error on the missing )

The DBRW does not easily allow for adding ASP coding variables

If it were being hand coded the syntax would have to separate ASP variables from the string sql string (or they are treated as text)

strSQL =
"SELECT COUNT(*) AS Recordcount FROM table WHERE datediff('d', CreatedDate, Date())<" & NoDays

So if using the DBRW use a form field for NoDays to compare to






|i know i said i was leaving it, but it's annoying me that it's not working
|
| The page not opening was because
| <%
| NoDays = Cint(Request.Form("NoDays")
| %>
|
| had a ) missing so should be
|
| <%
| NoDays = Cint(Request.Form("NoDays"))
| %>
|
| page now loads up but the variable is not passed at all
|
| I think i'm gonna cry
|
|
| Al....
|
|
|
| "Stefan B Rusynko" wrote:
|
| > See other response
| >
| > For your specific select add a form field (say NoDays, default value = 7) and get its value
| >
| > <%
| > NoDays = Cint(Request.Form("NoDays")
| > %>
| >
| > Then
| >
| > SELECT COUNT(*) AS Recordcount FROM table WHEREdatediff('d', CreatedDate, Date()) < NoDays
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > |I managed to get this working
| > |
| > | SELECT COUNT(*) AS Recordcount FROM table WHEREdatediff('d', CreatedDate,
| > | Date()) < 7
| > |
| > | table was changed to Results
| > | CreatedDate was changed to Timestamp <---i never done this the last time
| > | there should have been a space between WHERE and Datediff <--- i never noticed
| > |
| > | Now it works i need to be able to make the days variable if possible but
| > | still have a default value of 7
| > |
| > | I'm assuming that would be done with a TXT input but not quite sure how.
| > |
| > | Al....
| > |
| > | "Sproul" wrote:
| > |
| > | > Jon just to say that i tried just using "SELECT COUNT(*) AS Recordcount FROM
| > | > Results" and this returned a record count (as you probably already knew) i'd
| > | > been trying to do this for a few days.
| > | >
| > | > then i edited the other line you gave me and came out with this "SELECT
| > | > COUNT(*) AS Recordcount FROM Results WHERE (D1 = 'yes')" and this returned a
| > | > count of the records with yes
| > | >
| > | > so now i'm about half way there, just need to get the search done within the
| > | > last 7 days.
| > | >
| > | > So thanks jon
| > | >
| > | > it would probably be better if i got myself a book on this, can you tell me
| > | > what language is used (i'm assuming SQL)
| > | >
| > | > once again thanks, and keep up the good work
| > | >
| > | > "Jon Spivey" wrote:
| > | >
| > | > > Hi,
| > | > >
| > | > > You'd probably find this easier to do with 2 database results.
| > | > > 1/ For the record count use a custom query ike this
| > | > > SELECT COUNT(*) AS Recordcount
| > | > > FROM table WHEREdatediff('d', CreatedDate, Date()) < 7
| > | > > 2/ To display
| > | > > SELECT *, 'Yes' AS Yes
| > | > > FROM table WHEREdatediff('d', CreatedDate, Date()) < 7
| > | > >
| > | > > --
| > | > > Cheers,
| > | > > Jon
| > | > > Microsoft MVP
| > | > >
| > | > > | > | > > > I've got a database setup, i want to be able to count the number of
| > | > > > records
| > | > > > created within the last seven days and retunr only the number, next i need
| > | > > > to
| > | > > > look ath those records created and return the number of records with a yes
| > | > > > in
| > | > > > a specified column.
| > | > > >
| > | > > > Just to say i'm new to this but would like to learn more if anyone know's
| > | > > > any websites i can get usefull free information from.
| > | > > >
| > | > > > Al....
| > | > >
| > | > >
| > | > >
| >
| >
| >
 
S

Sproul

Thanks Mike And Stefan, again i get lots of lovley information.
On the good news side at the weekend i bought some books to do some study
with,

Microsoft Frontpage Inside Out
SQL (Visual Quickstart Guide) will use it a starting place
Access 2003 Tutorial CD

so i should get plenty of information (i hope), but i will remember to
consult the proffessionals if i need help.

Thanks again

Al....

P.S. i've kept note of all the reply's just incase it comes in handy.

Keep up the good work



Stefan B Rusynko said:
Sorry
- my typo error on the missing )

The DBRW does not easily allow for adding ASP coding variables

If it were being hand coded the syntax would have to separate ASP variables from the string sql string (or they are treated as text)

strSQL =
"SELECT COUNT(*) AS Recordcount FROM table WHERE datediff('d', CreatedDate, Date())<" & NoDays

So if using the DBRW use a form field for NoDays to compare to






|i know i said i was leaving it, but it's annoying me that it's not working
|
| The page not opening was because
| <%
| NoDays = Cint(Request.Form("NoDays")
| %>
|
| had a ) missing so should be
|
| <%
| NoDays = Cint(Request.Form("NoDays"))
| %>
|
| page now loads up but the variable is not passed at all
|
| I think i'm gonna cry
|
|
| Al....
|
|
|
| "Stefan B Rusynko" wrote:
|
| > See other response
| >
| > For your specific select add a form field (say NoDays, default value = 7) and get its value
| >
| > <%
| > NoDays = Cint(Request.Form("NoDays")
| > %>
| >
| > Then
| >
| > SELECT COUNT(*) AS Recordcount FROM table WHEREdatediff('d', CreatedDate, Date()) < NoDays
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > |I managed to get this working
| > |
| > | SELECT COUNT(*) AS Recordcount FROM table WHEREdatediff('d', CreatedDate,
| > | Date()) < 7
| > |
| > | table was changed to Results
| > | CreatedDate was changed to Timestamp <---i never done this the last time
| > | there should have been a space between WHERE and Datediff <--- i never noticed
| > |
| > | Now it works i need to be able to make the days variable if possible but
| > | still have a default value of 7
| > |
| > | I'm assuming that would be done with a TXT input but not quite sure how.
| > |
| > | Al....
| > |
| > | "Sproul" wrote:
| > |
| > | > Jon just to say that i tried just using "SELECT COUNT(*) AS Recordcount FROM
| > | > Results" and this returned a record count (as you probably already knew) i'd
| > | > been trying to do this for a few days.
| > | >
| > | > then i edited the other line you gave me and came out with this "SELECT
| > | > COUNT(*) AS Recordcount FROM Results WHERE (D1 = 'yes')" and this returned a
| > | > count of the records with yes
| > | >
| > | > so now i'm about half way there, just need to get the search done within the
| > | > last 7 days.
| > | >
| > | > So thanks jon
| > | >
| > | > it would probably be better if i got myself a book on this, can you tell me
| > | > what language is used (i'm assuming SQL)
| > | >
| > | > once again thanks, and keep up the good work
| > | >
| > | > "Jon Spivey" wrote:
| > | >
| > | > > Hi,
| > | > >
| > | > > You'd probably find this easier to do with 2 database results.
| > | > > 1/ For the record count use a custom query ike this
| > | > > SELECT COUNT(*) AS Recordcount
| > | > > FROM table WHEREdatediff('d', CreatedDate, Date()) < 7
| > | > > 2/ To display
| > | > > SELECT *, 'Yes' AS Yes
| > | > > FROM table WHEREdatediff('d', CreatedDate, Date()) < 7
| > | > >
| > | > > --
| > | > > Cheers,
| > | > > Jon
| > | > > Microsoft MVP
| > | > >
| > | > > | > | > > > I've got a database setup, i want to be able to count the number of
| > | > > > records
| > | > > > created within the last seven days and retunr only the number, next i need
| > | > > > to
| > | > > > look ath those records created and return the number of records with a yes
| > | > > > in
| > | > > > a specified column.
| > | > > >
| > | > > > Just to say i'm new to this but would like to learn more if anyone know's
| > | > > > any websites i can get usefull free information from.
| > | > > >
| > | > > > Al....
| > | > >
| > | > >
| > | > >
| >
| >
| >
 
Top