DRW query using current date

G

Guest

I am trying to set up a query in custom query to return field values in my
database based on current date base on year and month only using format of
mm/dd/yyy where dd will be a wild card value (I think?) have tried several
options such as

WHERE (PN = '::pN::' AND Period = '" & MonthName(Month(Date)) & " " &
Year(Date) & "')

WHERE (PN = '::pN::' AND Period = '" & Monthname(Date) & "/01/" & Year(Date)
& "')

WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "1" & Year(Date) & "')

WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "/01/" & Year(Date) &
"')

PN is another field

But no luck

If anyone has any ideas it would be greatly appreciated

trying to avoid using the defalt date as we would then have a lot of pages
to update each month

Thank you
 
S

Stefan B Rusynko

Try
WHERE (PN = '::pN::' AND Month(Period)=" & Month(Date()) & " AND Year(Period)=" &
Year(Date()) )


--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


|I am trying to set up a query in custom query to return field values in my
| database based on current date base on year and month only using format of
| mm/dd/yyy where dd will be a wild card value (I think?) have tried several
| options such as
|
| WHERE (PN = '::pN::' AND Period = '" & MonthName(Month(Date)) & " " &
| Year(Date) & "')
|
| WHERE (PN = '::pN::' AND Period = '" & Monthname(Date) & "/01/" & Year(Date)
| & "')
|
| WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "1" & Year(Date) & "')
|
| WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "/01/" & Year(Date) &
| "')
|
| PN is another field
|
| But no luck
|
| If anyone has any ideas it would be greatly appreciated
|
| trying to avoid using the defalt date as we would then have a lot of pages
| to update each month
|
| Thank you
 
G

Guest

Thank you Stefan

Looking good and works, just had to play with the sytax and got a result on

WHERE (PN = '::pN::' AND Month(Period)="" & Month(Date()) & "" AND
Year(Period)= "" & Year(Date()) )

This has been troubling me for days!
 
G

Guest

Stefan may I ask one more question on this please how do I get Perior =
greater than current month? Tried

WHERE (Period > ( Month(Period)="" & Month(Date()) & "" AND Year(Period)= ""
& Year(Date()) ) AND PN = '::pN::' )


But got current month still

Again thank you


Russell New zealand said:
Thank you Stefan

Looking good and works, just had to play with the sytax and got a result on

WHERE (PN = '::pN::' AND Month(Period)="" & Month(Date()) & "" AND
Year(Period)= "" & Year(Date()) )

This has been troubling me for days!

Stefan B Rusynko said:
Try
WHERE (PN = '::pN::' AND Month(Period)=" & Month(Date()) & " AND Year(Period)=" &
Year(Date()) )


--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


|I am trying to set up a query in custom query to return field values in my
| database based on current date base on year and month only using format of
| mm/dd/yyy where dd will be a wild card value (I think?) have tried several
| options such as
|
| WHERE (PN = '::pN::' AND Period = '" & MonthName(Month(Date)) & " " &
| Year(Date) & "')
|
| WHERE (PN = '::pN::' AND Period = '" & Monthname(Date) & "/01/" & Year(Date)
| & "')
|
| WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "1" & Year(Date) & "')
|
| WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "/01/" & Year(Date) &
| "')
|
| PN is another field
|
| But no luck
|
| If anyone has any ideas it would be greatly appreciated
|
| trying to avoid using the defalt date as we would then have a lot of pages
| to update each month
|
| Thank you
 
S

Stefan B Rusynko

Just

WHERE (PN = '::pN::' AND Month(Period)>"" & Month(Date()) & "" AND
Year(Period)= "" & Year(Date()) )



--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


| Stefan may I ask one more question on this please how do I get Perior =
| greater than current month? Tried
|
| WHERE (Period > ( Month(Period)="" & Month(Date()) & "" AND Year(Period)= ""
| & Year(Date()) ) AND PN = '::pN::' )
|
|
| But got current month still
|
| Again thank you
|
|
| "Russell New zealand" wrote:
|
| > Thank you Stefan
| >
| > Looking good and works, just had to play with the sytax and got a result on
| >
| > WHERE (PN = '::pN::' AND Month(Period)="" & Month(Date()) & "" AND
| > Year(Period)= "" & Year(Date()) )
| >
| > This has been troubling me for days!
| >
| > "Stefan B Rusynko" wrote:
| >
| > > Try
| > > WHERE (PN = '::pN::' AND Month(Period)=" & Month(Date()) & " AND Year(Period)=" &
| > > Year(Date()) )
| > >
| > >
| > > --
| > >
| > > _____________________________________________
| > > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > > "Warning - Using the F1 Key will not break anything!" (-;
| > > _____________________________________________
| > >
| > >
| > > | > > |I am trying to set up a query in custom query to return field values in my
| > > | database based on current date base on year and month only using format of
| > > | mm/dd/yyy where dd will be a wild card value (I think?) have tried several
| > > | options such as
| > > |
| > > | WHERE (PN = '::pN::' AND Period = '" & MonthName(Month(Date)) & " " &
| > > | Year(Date) & "')
| > > |
| > > | WHERE (PN = '::pN::' AND Period = '" & Monthname(Date) & "/01/" & Year(Date)
| > > | & "')
| > > |
| > > | WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "1" & Year(Date) & "')
| > > |
| > > | WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "/01/" & Year(Date) &
| > > | "')
| > > |
| > > | PN is another field
| > > |
| > > | But no luck
| > > |
| > > | If anyone has any ideas it would be greatly appreciated
| > > |
| > > | trying to avoid using the defalt date as we would then have a lot of pages
| > > | to update each month
| > > |
| > > | Thank you
| > >
| > >
| > >
 
G

Guest

With a great deal of help using current server date as query date has now
been achieved and we can get results. However we really need to use the
current date as our defalt date instead of inserting a current date into the
Frontpage DBRW reason is we are setting up lots of pages rather than one page
for editing by individual clients

Following are our field values and queries, our objective is to access
results or editor and have the default (current month) show up as the default
result then be able to search for different months

Fields are

PN - a numeric value that is put into the query by either hyperlink or
default in Frontpage Database Wizard

Period is a month represented by for example 10/1/2007 being October 1 2007

Current date SQL is either (equal) Month(Period)="" & Month(Date()) & "" AND
Year(Period)= "" & Year(Date()) (or greater than) Month(Period) > "" &
Month(Date()) & "" AND Year(Period)= "" & Year(Date())


Queries are

(PN = ::pN:: AND Period = '::period::')

(PN = ::pN:: AND (Period = '::period::' OR Period > '::period::'))

(Period > '::period::' AND PN = '::pN::')

(Period = '::period::' AND PN = '::pN::')

Any help in showing us how to include the current month as a default in
these queries would be greatly appreciated thank you, we have tried several
ways but get either weird or no result.

Stefan B Rusynko said:
Just

WHERE (PN = '::pN::' AND Month(Period)>"" & Month(Date()) & "" AND
Year(Period)= "" & Year(Date()) )



--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


| Stefan may I ask one more question on this please how do I get Perior =
| greater than current month? Tried
|
| WHERE (Period > ( Month(Period)="" & Month(Date()) & "" AND Year(Period)= ""
| & Year(Date()) ) AND PN = '::pN::' )
|
|
| But got current month still
|
| Again thank you
|
|
| "Russell New zealand" wrote:
|
| > Thank you Stefan
| >
| > Looking good and works, just had to play with the sytax and got a result on
| >
| > WHERE (PN = '::pN::' AND Month(Period)="" & Month(Date()) & "" AND
| > Year(Period)= "" & Year(Date()) )
| >
| > This has been troubling me for days!
| >
| > "Stefan B Rusynko" wrote:
| >
| > > Try
| > > WHERE (PN = '::pN::' AND Month(Period)=" & Month(Date()) & " AND Year(Period)=" &
| > > Year(Date()) )
| > >
| > >
| > > --
| > >
| > > _____________________________________________
| > > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > > "Warning - Using the F1 Key will not break anything!" (-;
| > > _____________________________________________
| > >
| > >
| > > | > > |I am trying to set up a query in custom query to return field values in my
| > > | database based on current date base on year and month only using format of
| > > | mm/dd/yyy where dd will be a wild card value (I think?) have tried several
| > > | options such as
| > > |
| > > | WHERE (PN = '::pN::' AND Period = '" & MonthName(Month(Date)) & " " &
| > > | Year(Date) & "')
| > > |
| > > | WHERE (PN = '::pN::' AND Period = '" & Monthname(Date) & "/01/" & Year(Date)
| > > | & "')
| > > |
| > > | WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "1" & Year(Date) & "')
| > > |
| > > | WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "/01/" & Year(Date) &
| > > | "')
| > > |
| > > | PN is another field
| > > |
| > > | But no luck
| > > |
| > > | If anyone has any ideas it would be greatly appreciated
| > > |
| > > | trying to avoid using the defalt date as we would then have a lot of pages
| > > | to update each month
| > > |
| > > | Thank you
| > >
| > >
| > >
 
S

Stefan B Rusynko

If period is a date field in your DB you need to have period as a numeric delimited value rather than as a text delimited value -
Month (Period) evaluates to a number not to text
- you can also combine the = and > as one test >=

(PN='::pN::' AND Month(Period)>=" & Month(Date()) & " AND Year(Period)>=" & Year(Date()) )


--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


|
| With a great deal of help using current server date as query date has now
| been achieved and we can get results. However we really need to use the
| current date as our defalt date instead of inserting a current date into the
| Frontpage DBRW reason is we are setting up lots of pages rather than one page
| for editing by individual clients
|
| Following are our field values and queries, our objective is to access
| results or editor and have the default (current month) show up as the default
| result then be able to search for different months
|
| Fields are
|
| PN - a numeric value that is put into the query by either hyperlink or
| default in Frontpage Database Wizard
|
| Period is a month represented by for example 10/1/2007 being October 1 2007
|
| Current date SQL is either (equal) Month(Period)="" & Month(Date()) & "" AND
| Year(Period)= "" & Year(Date()) (or greater than) Month(Period) > "" &
| Month(Date()) & "" AND Year(Period)= "" & Year(Date())
|
|
| Queries are
|
| (PN = ::pN:: AND Period = '::period::')
|
| (PN = ::pN:: AND (Period = '::period::' OR Period > '::period::'))
|
| (Period > '::period::' AND PN = '::pN::')
|
| (Period = '::period::' AND PN = '::pN::')
|
| Any help in showing us how to include the current month as a default in
| these queries would be greatly appreciated thank you, we have tried several
| ways but get either weird or no result.
|
| "Stefan B Rusynko" wrote:
|
| > Just
| >
| > WHERE (PN = '::pN::' AND Month(Period)>"" & Month(Date()) & "" AND
| > Year(Period)= "" & Year(Date()) )
| >
| >
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > _____________________________________________
| >
| >
| > | > | Stefan may I ask one more question on this please how do I get Perior =
| > | greater than current month? Tried
| > |
| > | WHERE (Period > ( Month(Period)="" & Month(Date()) & "" AND Year(Period)= ""
| > | & Year(Date()) ) AND PN = '::pN::' )
| > |
| > |
| > | But got current month still
| > |
| > | Again thank you
| > |
| > |
| > | "Russell New zealand" wrote:
| > |
| > | > Thank you Stefan
| > | >
| > | > Looking good and works, just had to play with the sytax and got a result on
| > | >
| > | > WHERE (PN = '::pN::' AND Month(Period)="" & Month(Date()) & "" AND
| > | > Year(Period)= "" & Year(Date()) )
| > | >
| > | > This has been troubling me for days!
| > | >
| > | > "Stefan B Rusynko" wrote:
| > | >
| > | > > Try
| > | > > WHERE (PN = '::pN::' AND Month(Period)=" & Month(Date()) & " AND Year(Period)=" &
| > | > > Year(Date()) )
| > | > >
| > | > >
| > | > > --
| > | > >
| > | > > _____________________________________________
| > | > > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > > "Warning - Using the F1 Key will not break anything!" (-;
| > | > > _____________________________________________
| > | > >
| > | > >
| > | > > | > | > > |I am trying to set up a query in custom query to return field values in my
| > | > > | database based on current date base on year and month only using format of
| > | > > | mm/dd/yyy where dd will be a wild card value (I think?) have tried several
| > | > > | options such as
| > | > > |
| > | > > | WHERE (PN = '::pN::' AND Period = '" & MonthName(Month(Date)) & " " &
| > | > > | Year(Date) & "')
| > | > > |
| > | > > | WHERE (PN = '::pN::' AND Period = '" & Monthname(Date) & "/01/" & Year(Date)
| > | > > | & "')
| > | > > |
| > | > > | WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "1" & Year(Date) & "')
| > | > > |
| > | > > | WHERE (PN = '::pN::' AND Period = '" & (Month(Date) & "/01/" & Year(Date) &
| > | > > | "')
| > | > > |
| > | > > | PN is another field
| > | > > |
| > | > > | But no luck
| > | > > |
| > | > > | If anyone has any ideas it would be greatly appreciated
| > | > > |
| > | > > | trying to avoid using the defalt date as we would then have a lot of pages
| > | > > | to update each month
| > | > > |
| > | > > | Thank you
| > | > >
| > | > >
| > | > >
| >
| >
| >
 

Ask a Question

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

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

Ask a Question

Top