Selecting birthday dates

G

Guest

Hi,not sure if I should be in the Access forum, but here goes! I am using an
Access database with a field in in for "birthdays". I think I need to either
write an Access Query to only select those people with a birthday coming up
in say the next month, and then report in out to an asp, or write an asp
directly from the table containing the field "birthday", to do the same
thing. So in the end asp shows say "names" and "birthdays" for the forcoming
month.
Thanks for your help and interst
 
T

Tom Willett

Yes, if you are looking for information on Access, you should post to an
Access forum. This is FrontPage.
 
S

Stefan B Rusynko

You would write your ASP code w/ a SQL query (of your DB) for a date range (for say next full month)
<%
StartDate = Date()
EndDate = DateAdd("m", 1, Date()))
strWhere = "birthdays=>#" & StartDate() & "# AND birthdays <#" & EndDate & "#"
strSQL = "Select names, birthdays FROM yourtablename " & strWhere & " Order by birthdays ASC"
' connect to your DB using the above strSQL and then write your 2 variables
%>
--

_____________________________________________
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.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Hi,not sure if I should be in the Access forum, but here goes! I am using an
| Access database with a field in in for "birthdays". I think I need to either
| write an Access Query to only select those people with a birthday coming up
| in say the next month, and then report in out to an asp, or write an asp
| directly from the table containing the field "birthday", to do the same
| thing. So in the end asp shows say "names" and "birthdays" for the forcoming
| month.
| Thanks for your help and interst
 
A

Anyone

Mick

Below is a chunk of ASP code for you. Basically it makes a connection
to an access database, runs a basic query on a table called
"BirthdayTable" which has two fields for a name and birthdate. It
returns those coming in the next month (the >Date() and <=DateAdd...),
runs through the returned records placing them all in a table.

Hope this helps.

Kind Regards

Andrew Brisbane
Microsoft MVP FrontPage
XZAKT Media, Australia.
http://www.xzmedia.com

'<<<<<<<<<<<<<<<<<<<<<<<<<<<<< CODE HERE! >>>>>>>>>>>>>>>>>>>>>>>>>

<TABLE>
<TR><TD>Name</TD><TD>Birthday</TD></TR>
<%
DataConn = "c:\domains\whatever.com\databaseYourDatabase.mdb" 'Path to
database
Set Conn = Server.CreateObject("ADODB.Connection")
ConStr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & DataConn &
";"
Conn.Open(ConStr)
SQL = "SELECT * FROM BirthdayTable WHERE [Birthday]>=Date() AND
[Birthday]<=DateAdd("m", 1, Date());"
Set RS = Conntemp.Execute(SQL)
if not RS.BOF then
while not RS.EOF then
%>
<TR><TD><%=RS.Fields("Name")%></TD><TD><%=RS.Fields("Birthday")%></TD>
</TR>
<%
RS.MoveNext
wend
end if
Rs.Close
Set RS = Nothing
Conn.Close
Set Conn = Nothing
%>
</TABLE>
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<< END OF CODE >>>>>>>>>>>>>>>>>>>>>>>>>
 

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

Similar Threads

birthday reminder 3
birthday reminder 4
Dates problem 5
Birthdays recreation in Outlook x64 3
how to refresh birthday appointments 6
Birthday format 11
Importing Birthday in Calendar 1
Birthdays within five days 12

Top