I need help with creating a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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....
 
Not possible to just post a "snippet" for you to do it
- depends on your DB structure, fields. connections

But you can try playing w/ the FP DBRW (database results wizard) if you have the DB created
- it should let you set both those criteria as one step to show only results that meet both criteria
See FP help on using DB

--




| 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....
 
everything was created with frontpage including the database, i suppose if i
could get it to count the records using the time stamp that would be a start,
i've looked a various help files but nothing can tell me how to count records
or how to only have last 7 days worth of records.

Thanks Stefan, i guess i'll just keep searching.
 
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
 
I know i'm a pain in the @~!< but it didn't work i assumed that table should
be changed to the name of my table in this case results, but i think it's
smething to do with the date, i'm using the timestamp function for each
record, therefore date & time goes into the field, or does that not matter
and therefore i'm babbling.

i'm sorry but as i said i am new to this, i know how hard it it to explain
something you know inside out to someone who knows nothing.

if you require any other information that may make it easier for you to help
me just let me know.

thanks jon much appreciated
 
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
 
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
And
Active Equals blnActive

Finish by selecting the Add a Search form option in the DBRW

In the search form created by the DBRW
in the Form Field named ChkDate
set the initial value to <%=ChkDate%>
and for the form field named Active
set the initial value to <%=blnActive%>
(you can make them hidden form fields if you want by setting the fields to type="hidden" instead of type="text" and delete all text
label cells)

Run the query page in the browser to see the detailed results

If you just want to show a single result of the # of records found (instead of a table of all the matching records found) in the
DBRW set the table to not show a header or split results per page,
Then in design view select ONLY the results data row (between the 2 yellow DBRW tags) in the Quick Tag selector and Delete that row
only
Switch to Code view and add the FP variable for record count (after the closing table tag) as say:
<p>The Record count is: <%=fp_iCount %></p>

You can also carefully delete the now empty table tags (not the DBRW content inside of them) by deleting in code view the 4 tags
<table width="100%"> <tbody> and </tbody></table>

ENJOY

--




| everything was created with frontpage including the database, i suppose if i
| could get it to count the records using the time stamp that would be a start,
| i've looked a various help files but nothing can tell me how to count records
| or how to only have last 7 days worth of records.
|
| Thanks Stefan, i guess i'll just keep searching.
|
| "Stefan B Rusynko" wrote:
|
| > Not possible to just post a "snippet" for you to do it
| > - depends on your DB structure, fields. connections
| >
| > But you can try playing w/ the FP DBRW (database results wizard) if you have the DB created
| > - it should let you set both those criteria as one step to show only results that meet both criteria
| > See FP help on using DB
| >
| > --
| >
| > _____________________________________________
| > 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'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....
| >
| >
| >
 
See my post on doing it in 1 step w/ the DBRW

--




| 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....
| >
| >
| >
 
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 said:
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
And
Active Equals blnActive

Finish by selecting the Add a Search form option in the DBRW

In the search form created by the DBRW
in the Form Field named ChkDate
set the initial value to <%=ChkDate%>
and for the form field named Active
set the initial value to <%=blnActive%>
(you can make them hidden form fields if you want by setting the fields to type="hidden" instead of type="text" and delete all text
label cells)

Run the query page in the browser to see the detailed results

If you just want to show a single result of the # of records found (instead of a table of all the matching records found) in the
DBRW set the table to not show a header or split results per page,
Then in design view select ONLY the results data row (between the 2 yellow DBRW tags) in the Quick Tag selector and Delete that row
only
Switch to Code view and add the FP variable for record count (after the closing table tag) as say:
<p>The Record count is: <%=fp_iCount %></p>

You can also carefully delete the now empty table tags (not the DBRW content inside of them) by deleting in code view the 4 tags
<table width="100%"> <tbody> and </tbody></table>

ENJOY

--




| everything was created with frontpage including the database, i suppose if i
| could get it to count the records using the time stamp that would be a start,
| i've looked a various help files but nothing can tell me how to count records
| or how to only have last 7 days worth of records.
|
| Thanks Stefan, i guess i'll just keep searching.
|
| "Stefan B Rusynko" wrote:
|
| > Not possible to just post a "snippet" for you to do it
| > - depends on your DB structure, fields. connections
| >
| > But you can try playing w/ the FP DBRW (database results wizard) if you have the DB created
| > - it should let you set both those criteria as one step to show only results that meet both criteria
| > See FP help on using DB
| >
| > --
| >
| > _____________________________________________
| > 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'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....
| >
| >
| >
 
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
--




| 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
| > And
| > Active Equals blnActive
| >
| > Finish by selecting the Add a Search form option in the DBRW
| >
| > In the search form created by the DBRW
| > in the Form Field named ChkDate
| > set the initial value to <%=ChkDate%>
| > and for the form field named Active
| > set the initial value to <%=blnActive%>
| > (you can make them hidden form fields if you want by setting the fields to type="hidden" instead of type="text" and delete all
text
| > label cells)
| >
| > Run the query page in the browser to see the detailed results
| >
| > If you just want to show a single result of the # of records found (instead of a table of all the matching records found) in
the
| > DBRW set the table to not show a header or split results per page,
| > Then in design view select ONLY the results data row (between the 2 yellow DBRW tags) in the Quick Tag selector and Delete that
row
| > only
| > Switch to Code view and add the FP variable for record count (after the closing table tag) as say:
| > <p>The Record count is: <%=fp_iCount %></p>
| >
| > You can also carefully delete the now empty table tags (not the DBRW content inside of them) by deleting in code view the 4 tags
| > <table width="100%"> <tbody> and </tbody></table>
| >
| > ENJOY
| >
| > --
| >
| > _____________________________________________
| > 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
| > _____________________________________________
| >
| >
| > | everything was created with frontpage including the database, i suppose if i
| > | could get it to count the records using the time stamp that would be a start,
| > | i've looked a various help files but nothing can tell me how to count records
| > | or how to only have last 7 days worth of records.
| > |
| > | Thanks Stefan, i guess i'll just keep searching.
| > |
| > | "Stefan B Rusynko" wrote:
| > |
| > | > Not possible to just post a "snippet" for you to do it
| > | > - depends on your DB structure, fields. connections
| > | >
| > | > But you can try playing w/ the FP DBRW (database results wizard) if you have the DB created
| > | > - it should let you set both those criteria as one step to show only results that meet both criteria
| > | > See FP help on using DB
| > | >
| > | > --
| > | >
| > | > _____________________________________________
| > | > 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'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....
| > | >
| > | >
| > | >
| >
| >
| >
 
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 said:
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
--




| 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
| > And
| > Active Equals blnActive
| >
| > Finish by selecting the Add a Search form option in the DBRW
| >
| > In the search form created by the DBRW
| > in the Form Field named ChkDate
| > set the initial value to <%=ChkDate%>
| > and for the form field named Active
| > set the initial value to <%=blnActive%>
| > (you can make them hidden form fields if you want by setting the fields to type="hidden" instead of type="text" and delete all
text
| > label cells)
| >
| > Run the query page in the browser to see the detailed results
| >
| > If you just want to show a single result of the # of records found (instead of a table of all the matching records found) in
the
| > DBRW set the table to not show a header or split results per page,
| > Then in design view select ONLY the results data row (between the 2 yellow DBRW tags) in the Quick Tag selector and Delete that
row
| > only
| > Switch to Code view and add the FP variable for record count (after the closing table tag) as say:
| > <p>The Record count is: <%=fp_iCount %></p>
| >
| > You can also carefully delete the now empty table tags (not the DBRW content inside of them) by deleting in code view the 4 tags
| > <table width="100%"> <tbody> and </tbody></table>
| >
| > ENJOY
| >
| > --
| >
| > _____________________________________________
| > 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
| > _____________________________________________
| >
| >
| > | everything was created with frontpage including the database, i suppose if i
| > | could get it to count the records using the time stamp that would be a start,
| > | i've looked a various help files but nothing can tell me how to count records
| > | or how to only have last 7 days worth of records.
| > |
| > | Thanks Stefan, i guess i'll just keep searching.
| > |
| > | "Stefan B Rusynko" wrote:
| > |
| > | > Not possible to just post a "snippet" for you to do it
| > | > - depends on your DB structure, fields. connections
| > | >
| > | > But you can try playing w/ the FP DBRW (database results wizard) if you have the DB created
| > | > - it should let you set both those criteria as one step to show only results that meet both criteria
| > | > See FP help on using DB
| > | >
| > | > --
| > | >
| > | > _____________________________________________
| > | > 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'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....
| > | >
| > | >
| > | >
| >
| >
| >
 
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="


--




| 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
| > _____________________________________________
| >
| >
| > | 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
| > | > And
| > | > Active Equals blnActive
| > | >
| > | > Finish by selecting the Add a Search form option in the DBRW
| > | >
| > | > In the search form created by the DBRW
| > | > in the Form Field named ChkDate
| > | > set the initial value to <%=ChkDate%>
| > | > and for the form field named Active
| > | > set the initial value to <%=blnActive%>
| > | > (you can make them hidden form fields if you want by setting the fields to type="hidden" instead of type="text" and delete
all
| > text
| > | > label cells)
| > | >
| > | > Run the query page in the browser to see the detailed results
| > | >
| > | > If you just want to show a single result of the # of records found (instead of a table of all the matching records found)
in
| > the
| > | > DBRW set the table to not show a header or split results per page,
| > | > Then in design view select ONLY the results data row (between the 2 yellow DBRW tags) in the Quick Tag selector and Delete
that
| > row
| > | > only
| > | > Switch to Code view and add the FP variable for record count (after the closing table tag) as say:
| > | > <p>The Record count is: <%=fp_iCount %></p>
| > | >
| > | > You can also carefully delete the now empty table tags (not the DBRW content inside of them) by deleting in code view the 4
tags
| > | > <table width="100%"> <tbody> and </tbody></table>
| > | >
| > | > ENJOY
| > | >
| > | > --
| > | >
| > | > _____________________________________________
| > | > 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
| > | > _____________________________________________
| > | >
| > | >
| > | > | everything was created with frontpage including the database, i suppose if i
| > | > | could get it to count the records using the time stamp that would be a start,
| > | > | i've looked a various help files but nothing can tell me how to count records
| > | > | or how to only have last 7 days worth of records.
| > | > |
| > | > | Thanks Stefan, i guess i'll just keep searching.
| > | > |
| > | > | "Stefan B Rusynko" wrote:
| > | > |
| > | > | > Not possible to just post a "snippet" for you to do it
| > | > | > - depends on your DB structure, fields. connections
| > | > | >
| > | > | > But you can try playing w/ the FP DBRW (database results wizard) if you have the DB created
| > | > | > - it should let you set both those criteria as one step to show only results that meet both criteria
| > | > | > See FP help on using DB
| > | > | >
| > | > | > --
| > | > | >
| > | > | > _____________________________________________
| > | > | > 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'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....
| > | > | >
| > | > | >
| > | > | >
| > | >
| > | >
| > | >
| >
| >
| >
 
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 said:
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="


--




| 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
| > _____________________________________________
| >
| >
| > | 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
| > | > And
| > | > Active Equals blnActive
| > | >
| > | > Finish by selecting the Add a Search form option in the DBRW
| > | >
| > | > In the search form created by the DBRW
| > | > in the Form Field named ChkDate
| > | > set the initial value to <%=ChkDate%>
| > | > and for the form field named Active
| > | > set the initial value to <%=blnActive%>
| > | > (you can make them hidden form fields if you want by setting the fields to type="hidden" instead of type="text" and delete
all
| > text
| > | > label cells)
| > | >
| > | > Run the query page in the browser to see the detailed results
| > | >
| > | > If you just want to show a single result of the # of records found (instead of a table of all the matching records found)
in
| > the
| > | > DBRW set the table to not show a header or split results per page,
| > | > Then in design view select ONLY the results data row (between the 2 yellow DBRW tags) in the Quick Tag selector and Delete
that
| > row
| > | > only
| > | > Switch to Code view and add the FP variable for record count (after the closing table tag) as say:
| > | > <p>The Record count is: <%=fp_iCount %></p>
| > | >
| > | > You can also carefully delete the now empty table tags (not the DBRW content inside of them) by deleting in code view the 4
tags
| > | > <table width="100%"> <tbody> and </tbody></table>
| > | >
| > | > ENJOY
| > | >
| > | > --
| > | >
| > | > _____________________________________________
| > | > 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
| > | > _____________________________________________
| > | >
| > | >
| > | > | everything was created with frontpage including the database, i suppose if i
| > | > | could get it to count the records using the time stamp that would be a start,
| > | > | i've looked a various help files but nothing can tell me how to count records
| > | > | or how to only have last 7 days worth of records.
| > | > |
| > | > | Thanks Stefan, i guess i'll just keep searching.
| > | > |
| > | > | "Stefan B Rusynko" wrote:
| > | > |
| > | > | > Not possible to just post a "snippet" for you to do it
| > | > | > - depends on your DB structure, fields. connections
| > | > | >
| > | > | > But you can try playing w/ the FP DBRW (database results wizard) if you have the DB created
| > | > | > - it should let you set both those criteria as one step to show only results that meet both criteria
| > | > | > See FP help on using DB
| > | > | >
| > | > | > --
| > | > | >
| > | > | > _____________________________________________
| > | > | > 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'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....
| > | > | >
| > | > | >
| > | > | >
| > | >
| > | >
| > | >
| >
| >
| >
 
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


--




| 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
| > | > _____________________________________________
| > | >
| > | >
| > | > | 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
| > | > | > And
| > | > | > Active Equals blnActive
| > | > | >
| > | > | > Finish by selecting the Add a Search form option in the DBRW
| > | > | >
| > | > | > In the search form created by the DBRW
| > | > | > in the Form Field named ChkDate
| > | > | > set the initial value to <%=ChkDate%>
| > | > | > and for the form field named Active
| > | > | > set the initial value to <%=blnActive%>
| > | > | > (you can make them hidden form fields if you want by setting the fields to type="hidden" instead of type="text" and
delete
| > all
| > | > text
| > | > | > label cells)
| > | > | >
| > | > | > Run the query page in the browser to see the detailed results
| > | > | >
| > | > | > If you just want to show a single result of the # of records found (instead of a table of all the matching records
found)
| > in
| > | > the
| > | > | > DBRW set the table to not show a header or split results per page,
| > | > | > Then in design view select ONLY the results data row (between the 2 yellow DBRW tags) in the Quick Tag selector and
Delete
| > that
| > | > row
| > | > | > only
| > | > | > Switch to Code view and add the FP variable for record count (after the closing table tag) as say:
| > | > | > <p>The Record count is: <%=fp_iCount %></p>
| > | > | >
| > | > | > You can also carefully delete the now empty table tags (not the DBRW content inside of them) by deleting in code view
the 4
| > tags
| > | > | > <table width="100%"> <tbody> and </tbody></table>
| > | > | >
| > | > | > ENJOY
| > | > | >
| > | > | > --
| > | > | >
| > | > | > _____________________________________________
| > | > | > 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
| > | > | > _____________________________________________
| > | > | >
| > | > | >
| > | > | > | everything was created with frontpage including the database, i suppose if i
| > | > | > | could get it to count the records using the time stamp that would be a start,
| > | > | > | i've looked a various help files but nothing can tell me how to count records
| > | > | > | or how to only have last 7 days worth of records.
| > | > | > |
| > | > | > | Thanks Stefan, i guess i'll just keep searching.
| > | > | > |
| > | > | > | "Stefan B Rusynko" wrote:
| > | > | > |
| > | > | > | > Not possible to just post a "snippet" for you to do it
| > | > | > | > - depends on your DB structure, fields. connections
| > | > | > | >
| > | > | > | > But you can try playing w/ the FP DBRW (database results wizard) if you have the DB created
| > | > | > | > - it should let you set both those criteria as one step to show only results that meet both criteria
| > | > | > | > See FP help on using DB
| > | > | > | >
| > | > | > | > --
| > | > | > | >
| > | > | > | > _____________________________________________
| > | > | > | > 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'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....
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | >
| > | >
| > | >
| >
| >
| >
 
getting a bit busy here, i'll go through everything when it calms down,
thanks for your help and i'll post a reply with the results


Al....

Stefan B Rusynko said:
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


--




| 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
| > | > _____________________________________________
| > | >
| > | >
| > | > | 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
| > | > | > And
| > | > | > Active Equals blnActive
| > | > | >
| > | > | > Finish by selecting the Add a Search form option in the DBRW
| > | > | >
| > | > | > In the search form created by the DBRW
| > | > | > in the Form Field named ChkDate
| > | > | > set the initial value to <%=ChkDate%>
| > | > | > and for the form field named Active
| > | > | > set the initial value to <%=blnActive%>
| > | > | > (you can make them hidden form fields if you want by setting the fields to type="hidden" instead of type="text" and
delete
| > all
| > | > text
| > | > | > label cells)
| > | > | >
| > | > | > Run the query page in the browser to see the detailed results
| > | > | >
| > | > | > If you just want to show a single result of the # of records found (instead of a table of all the matching records
found)
| > in
| > | > the
| > | > | > DBRW set the table to not show a header or split results per page,
| > | > | > Then in design view select ONLY the results data row (between the 2 yellow DBRW tags) in the Quick Tag selector and
Delete
| > that
| > | > row
| > | > | > only
| > | > | > Switch to Code view and add the FP variable for record count (after the closing table tag) as say:
| > | > | > <p>The Record count is: <%=fp_iCount %></p>
| > | > | >
| > | > | > You can also carefully delete the now empty table tags (not the DBRW content inside of them) by deleting in code view
the 4
| > tags
| > | > | > <table width="100%"> <tbody> and </tbody></table>
| > | > | >
| > | > | > ENJOY
| > | > | >
| > | > | > --
| > | > | >
| > | > | > _____________________________________________
| > | > | > 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
| > | > | > _____________________________________________
| > | > | >
| > | > | >
| > | > | > | everything was created with frontpage including the database, i suppose if i
| > | > | > | could get it to count the records using the time stamp that would be a start,
| > | > | > | i've looked a various help files but nothing can tell me how to count records
| > | > | > | or how to only have last 7 days worth of records.
| > | > | > |
| > | > | > | Thanks Stefan, i guess i'll just keep searching.
| > | > | > |
| > | > | > | "Stefan B Rusynko" wrote:
| > | > | > |
| > | > | > | > Not possible to just post a "snippet" for you to do it
| > | > | > | > - depends on your DB structure, fields. connections
| > | > | > | >
| > | > | > | > But you can try playing w/ the FP DBRW (database results wizard) if you have the DB created
| > | > | > | > - it should let you set both those criteria as one step to show only results that meet both criteria
| > | > | > | > See FP help on using DB
| > | > | > | >
| > | > | > | > --
| > | > | > | >
| > | > | > | > _____________________________________________
| > | > | > | > 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'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....
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | >
| > | >
| > | >
| >
| >
| >
 
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 said:
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


--




| 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
| > | > _____________________________________________
| > | >
| > | >
| > | > | 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
| > | > | > And
| > | > | > Active Equals blnActive
| > | > | >
| > | > | > Finish by selecting the Add a Search form option in the DBRW
| > | > | >
| > | > | > In the search form created by the DBRW
| > | > | > in the Form Field named ChkDate
| > | > | > set the initial value to <%=ChkDate%>
| > | > | > and for the form field named Active
| > | > | > set the initial value to <%=blnActive%>
| > | > | > (you can make them hidden form fields if you want by setting the fields to type="hidden" instead of type="text" and
delete
| > all
| > | > text
| > | > | > label cells)
| > | > | >
| > | > | > Run the query page in the browser to see the detailed results
| > | > | >
| > | > | > If you just want to show a single result of the # of records found (instead of a table of all the matching records
found)
| > in
| > | > the
| > | > | > DBRW set the table to not show a header or split results per page,
| > | > | > Then in design view select ONLY the results data row (between the 2 yellow DBRW tags) in the Quick Tag selector and
Delete
| > that
| > | > row
| > | > | > only
| > | > | > Switch to Code view and add the FP variable for record count (after the closing table tag) as say:
| > | > | > <p>The Record count is: <%=fp_iCount %></p>
| > | > | >
| > | > | > You can also carefully delete the now empty table tags (not the DBRW content inside of them) by deleting in code view
the 4
| > tags
| > | > | > <table width="100%"> <tbody> and </tbody></table>
| > | > | >
| > | > | > ENJOY
| > | > | >
| > | > | > --
| > | > | >
| > | > | > _____________________________________________
| > | > | > 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
| > | > | > _____________________________________________
| > | > | >
| > | > | >
| > | > | > | everything was created with frontpage including the database, i suppose if i
| > | > | > | could get it to count the records using the time stamp that would be a start,
| > | > | > | i've looked a various help files but nothing can tell me how to count records
| > | > | > | or how to only have last 7 days worth of records.
| > | > | > |
| > | > | > | Thanks Stefan, i guess i'll just keep searching.
| > | > | > |
| > | > | > | "Stefan B Rusynko" wrote:
| > | > | > |
| > | > | > | > Not possible to just post a "snippet" for you to do it
| > | > | > | > - depends on your DB structure, fields. connections
| > | > | > | >
| > | > | > | > But you can try playing w/ the FP DBRW (database results wizard) if you have the DB created
| > | > | > | > - it should let you set both those criteria as one step to show only results that meet both criteria
| > | > | > | > See FP help on using DB
| > | > | > | >
| > | > | > | > --
| > | > | > | >
| > | > | > | > _____________________________________________
| > | > | > | > 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'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....
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | >
| > | >
| > | >
| >
| >
| >
 
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


--




| 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
| > | > | > _____________________________________________
| > | > | >
| > | > | >
| > | > | > | 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
| > | > | > | > And
| > | > | > | > Active Equals blnActive
| > | > | > | >
| > | > | > | > Finish by selecting the Add a Search form option in the DBRW
| > | > | > | >
|> | > | > | > In the search form created by the DBRW
| > | > | > | > in the Form Field named ChkDate
| > | > | > | > set the initial value to <%=ChkDate%>
| > | > | > | > and for the form field named Active
| > | > | > | > set the initial value to <%=blnActive%>
| > | > | > | > (you can make them hidden form fields if you want by setting the fields to type="hidden" instead of type="text" and
| > delete
| > | > all
| > | > | > text
| > | > | > | > label cells)
| > | > | > | >
| > | > | > | > Run the query page in the browser to see the detailed results
| > | > | > | >
| > | > | > | > If you just want to show a single result of the # of records found (instead of a table of all the matching records
| > found)
| > | > in
| > | > | > the
| > | > | > | > DBRW set the table to not show a header or split results per page,
| > | > | > | > Then in design view select ONLY the results data row (between the 2 yellow DBRW tags) in the Quick Tag selector and
| > Delete
| > | > that
| > | > | > row
| > | > | > | > only
| > | > | > | > Switch to Code view and add the FP variable for record count (after the closing table tag) as say:
| > | > | > | > <p>The Record count is: <%=fp_iCount %></p>
| > | > | > | >
| > | > | > | > You can also carefully delete the now empty table tags (not the DBRW content inside of them) by deleting in code
view
| > the 4
| > | > tags
| > | > | > | > <table width="100%"> <tbody> and </tbody></table>
| > | > | > | >
| > | > | > | > ENJOY
| > | > | > | >
| > | > | > | > --
| > | > | > | >
| > | > | > | > _____________________________________________
| > | > | > | > 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
| > | > | > | > _____________________________________________
| > | > | > | >
| > | > | > | >
| > | > | > | > | everything was created with frontpage including the database, i suppose if i
| > | > | > | > | could get it to count the records using the time stamp that would be a start,
| > | > | > | > | i've looked a various help files but nothing can tell me how to count records
| > | > | > | > | or how to only have last 7 days worth of records.
| > | > | > | > |
| > | > | > | > | Thanks Stefan, i guess i'll just keep searching.
| > | > | > | > |
| > | > | > | > | "Stefan B Rusynko" wrote:
| > | > | > | > |
| > | > | > | > | > Not possible to just post a "snippet" for you to do it
| > | > | > | > | > - depends on your DB structure, fields. connections
| > | > | > | > | >
| > | > | > | > | > But you can try playing w/ the FP DBRW (database results wizard) if you have the DB created
| > | > | > | > | > - it should let you set both those criteria as one step to show only results that meet both criteria
| > | > | > | > | > See FP help on using DB
| > | > | > | > | >
| > | > | > | > | > --
| > | > | > | > | >
| > | > | > | > | > _____________________________________________
| > | > | > | > | > 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'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....
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | >
| > | >
| > | >
| >
| >
| >
 
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.

Stefan B Rusynko said:
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


--




| 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
| > | > | > | > And
| > | > | > | > Active Equals blnActive
| > | > | > | >
| > | > | > | > Finish by selecting the Add a Search form option in
the DBRW
| > | > | > | >
|> | > | > | > In the search form created by the DBRW
| > | > | > | > in the Form Field named ChkDate
| > | > | > | > set the initial value to <%=ChkDate%>
| > | > | > | > and for the form field named Active
| > | > | > | > set the initial value to <%=blnActive%>
| > | > | > | > (you can make them hidden form fields if you want by
setting the fields to type="hidden" instead of type="text" and
| > delete
| > | > all
| > | > | > text
| > | > | > | > label cells)
| > | > | > | >
| > | > | > | > Run the query page in the browser to see the
detailed results
| > | > | > | >
| > | > | > | > If you just want to show a single result of the # of
records found (instead of a table of all the matching records
| > found)
| > | > in
| > | > | > the
| > | > | > | > DBRW set the table to not show a header or split
results per page,
| > | > | > | > Then in design view select ONLY the results data row
(between the 2 yellow DBRW tags) in the Quick Tag selector and
| > Delete
| > | > that
| > | > | > row
| > | > | > | > only
| > | > | > | > Switch to Code view and add the FP variable for
record count (after the closing table tag) as say:
| > | > | > | > <p>The Record count is: <%=fp_iCount %></p>
| > | > | > | >
| > | > | > | > You can also carefully delete the now empty table
tags (not the DBRW content inside of them) by deleting in code
view
| > the 4
| > | > tags
| > | > | > | > <table width="100%"> <tbody> and </tbody></table>
| > | > | > | >
| > | > | > | > ENJOY
| > | > | > | >
| > | > | > | > --
| > | > | > | >
| > | > | > | > _____________________________________________
| > | > | > | > 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
| > | > | > | > | everything was created with frontpage including
the database, i suppose if i
| > | > | > | > | could get it to count the records using the time
stamp that would be a start,
| > | > | > | > | i've looked a various help files but nothing can
tell me how to count records
| > | > | > | > | or how to only have last 7 days worth of records.
| > | > | > | > |
| > | > | > | > | Thanks Stefan, i guess i'll just keep searching.
| > | > | > | > |
| > | > | > | > | "Stefan B Rusynko" wrote:
| > | > | > | > |
| > | > | > | > | > Not possible to just post a "snippet" for you to
do it
| > | > | > | > | > - depends on your DB structure, fields.
connections
| > | > | > | > | >
| > | > | > | > | > But you can try playing w/ the FP DBRW (database
results wizard) if you have the DB created
| > | > | > | > | > - it should let you set both those criteria as
one step to show only results that meet both criteria
| > | > | > | > | > See FP help on using DB
| > | > | > | > | >
| > | > | > | > | > --
| > | > | > | > | >
| > | > | > | > | > _____________________________________________
| > | > | > | > | > 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
| > | > | > | > | > _____________________________________________
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | > "Sproul" <[email protected]>
wrote in message
| > | > | > | > | > | > | 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....
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | >
| > | >
| > | >
| >
| >
| >
 
The square brackets are required for insert/update queries, but may
work without them in Select queries. Only the field name in the SQL
needs to have the brackets.
--
Ron Symonds
Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

Ronx said:
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.

Stefan B Rusynko said:
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


--




| 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
| > | > _____________________________________________
| > | >
| > | >
message | > | > | 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
| > | > | > | > And
| > | > | > | > Active Equals blnActive
| > | > | > | >
| > | > | > | > Finish by selecting the Add a Search form option in
the DBRW
| > | > | > | >
|> | > | > | > In the search form created by the DBRW
| > | > | > | > in the Form Field named ChkDate
| > | > | > | > set the initial value to <%=ChkDate%>
| > | > | > | > and for the form field named Active
| > | > | > | > set the initial value to <%=blnActive%>
| > | > | > | > (you can make them hidden form fields if you want
by setting the fields to type="hidden" instead of type="text" and
| > delete
| > | > all
| > | > | > text
| > | > | > | > label cells)
| > | > | > | >
| > | > | > | > Run the query page in the browser to see the
detailed results
| > | > | > | >
| > | > | > | > If you just want to show a single result of the #
of records found (instead of a table of all the matching records
| > found)
| > | > in
| > | > | > the
| > | > | > | > DBRW set the table to not show a header or split
results per page,
| > | > | > | > Then in design view select ONLY the results data
row (between the 2 yellow DBRW tags) in the Quick Tag selector and
| > Delete
| > | > that
| > | > | > row
| > | > | > | > only
| > | > | > | > Switch to Code view and add the FP variable for
record count (after the closing table tag) as say:
| > | > | > | > <p>The Record count is: <%=fp_iCount %></p>
| > | > | > | >
| > | > | > | > You can also carefully delete the now empty table
tags (not the DBRW content inside of them) by deleting in code
view
| > the 4
| > | > tags
| > | > | > | > <table width="100%"> <tbody> and </tbody></table>
| > | > | > | >
| > | > | > | > ENJOY
| > | > | > | >
| > | > | > | > --
| > | > | > | >
| > | > | > | > _____________________________________________
| > | > | > | > 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
| > | > | > | > _____________________________________________
| > | > | > | >
| > | > | > | >
in message
| > | > | > | > | everything was created with frontpage including
the database, i suppose if i
| > | > | > | > | could get it to count the records using the time
stamp that would be a start,
| > | > | > | > | i've looked a various help files but nothing can
tell me how to count records
| > | > | > | > | or how to only have last 7 days worth of records.
| > | > | > | > |
| > | > | > | > | Thanks Stefan, i guess i'll just keep searching.
| > | > | > | > |
| > | > | > | > | "Stefan B Rusynko" wrote:
| > | > | > | > |
| > | > | > | > | > Not possible to just post a "snippet" for you
to do it
| > | > | > | > | > - depends on your DB structure, fields.
connections
| > | > | > | > | >
| > | > | > | > | > But you can try playing w/ the FP DBRW
(database results wizard) if you have the DB created
| > | > | > | > | > - it should let you set both those criteria as
one step to show only results that meet both criteria
| > | > | > | > | > See FP help on using DB
| > | > | > | > | >
| > | > | > | > | > --
| > | > | > | > | >
| > | > | > | > | > _____________________________________________
| > | > | > | > | > 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
| > | > | > | > | > _____________________________________________
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | > "Sproul" <[email protected]>
wrote in message
| > | > | > | > | > | > | 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....
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | >
| > | >
| > | >
| >
| >
| >
 
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
| > | > | > | > | > And
| > | > | > | > | > Active Equals blnActive
| > | > | > | > | >
| > | > | > | > | > Finish by selecting the Add a Search form option in
| > the DBRW
| > | > | > | > | >
| > |> | > | > | > In the search form created by the DBRW
| > | > | > | > | > in the Form Field named ChkDate
| > | > | > | > | > set the initial value to <%=ChkDate%>
| > | > | > | > | > and for the form field named Active
| > | > | > | > | > set the initial value to <%=blnActive%>
| > | > | > | > | > (you can make them hidden form fields if you want by
| > setting the fields to type="hidden" instead of type="text" and
| > | > delete
| > | > | > all
| > | > | > | > text
| > | > | > | > | > label cells)
| > | > | > | > | >
| > | > | > | > | > Run the query page in the browser to see the
| > detailed results
| > | > | > | > | >
| > | > | > | > | > If you just want to show a single result of the # of
| > records found (instead of a table of all the matching records
| > | > found)
| > | > | > in
| > | > | > | > the
| > | > | > | > | > DBRW set the table to not show a header or split
| > results per page,
| > | > | > | > | > Then in design view select ONLY the results data row
| > (between the 2 yellow DBRW tags) in the Quick Tag selector and
| > | > Delete
| > | > | > that
| > | > | > | > row
| > | > | > | > | > only
| > | > | > | > | > Switch to Code view and add the FP variable for
| > record count (after the closing table tag) as say:
| > | > | > | > | > <p>The Record count is: <%=fp_iCount %></p>
| > | > | > | > | >
| > | > | > | > | > You can also carefully delete the now empty table
| > tags (not the DBRW content inside of them) by deleting in code
| > view
| > | > the 4
| > | > | > tags
| > | > | > | > | > <table width="100%"> <tbody> and </tbody></table>
| > | > | > | > | >
| > | > | > | > | > ENJOY
| > | > | > | > | >
| > | > | > | > | > --
| > | > | > | > | >
| > | > | > | > | > _____________________________________________
| > | > | > | > | > 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
| > | > | > | > | > | > | everything was created with frontpage including
| > the database, i suppose if i
| > | > | > | > | > | could get it to count the records using the time
| > stamp that would be a start,
| > | > | > | > | > | i've looked a various help files but nothing can
| > tell me how to count records
| > | > | > | > | > | or how to only have last 7 days worth of records.
| > | > | > | > | > |
| > | > | > | > | > | Thanks Stefan, i guess i'll just keep searching.
| > | > | > | > | > |
| > | > | > | > | > | "Stefan B Rusynko" wrote:
| > | > | > | > | > |
| > | > | > | > | > | > Not possible to just post a "snippet" for you to
| > do it
| > | > | > | > | > | > - depends on your DB structure, fields.
| > connections
| > | > | > | > | > | >
| > | > | > | > | > | > But you can try playing w/ the FP DBRW (database
| > results wizard) if you have the DB created
| > | > | > | > | > | > - it should let you set both those criteria as
| > one step to show only results that meet both criteria
| > | > | > | > | > | > See FP help on using DB
| > | > | > | > | > | >
| > | > | > | > | > | > --
| > | > | > | > | > | >
| > | > | > | > | > | > _____________________________________________
| > | > | > | > | > | > 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
| > | > | > | > | > | > _____________________________________________
| > | > | > | > | > | >
| > | > | > | > | > | >
| > | > | > | > | > | > "Sproul" <[email protected]>
| > wrote in message
| > | > | > | > | > | > | > | > | 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....
| > | > | > | > | > | >
| > | > | > | > | > | >
| > | > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | >
| > | >
| > | >
| >
| >
|
|
 
Back
Top