OutFront Forums
     Home    Register     Search      Help      Login    

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

Appointments!

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Appointments!
Page: [1] 2   next >   >>
 
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
Appointments! - 8/24/2009 12:01:45   
My Table has the following fields:
ID “Auto number”
firstname “text”
lastname “text”
ptnumber “text” unique number
nextapt “date/time”

Nextapt field contains dates that could be old or new dates for the same person. I want to find a way using DRW, who does not have an appointment! Meaning not today or in the future! Any ideas please?
TexasWebDevelopers

 

Posts: 722
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: Appointments! - 8/24/2009 12:14:35   
How far in the future?
1 years ...10 years?

This gives you the folks who have an appointment between today and you year from today.

SQL= "SELECT * FROM [table_name] WHERE nextapt BETWEEN Date() And Date()+365"

If they don't have an appointment would there be no data in the nextapt column? so it would just return a null value?

_____________________________

:)

Follow us on TWITTER

(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 8/25/2009 13:06:58   
Thanks for reply! I need a function that check all the ptnumber to see if the nextapt is not greater than current date and then display that ptnumer this way I get only people without appt! any idea about this function please?

< Message edited by box -- 8/25/2009 13:13:57 >

(in reply to TexasWebDevelopers)
TexasWebDevelopers

 

Posts: 722
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: Appointments! - 8/25/2009 14:23:18   
If they don't have an appointment would there be no data in the nextapt column? so it would just return a null value? Or are you defaulting the data to a value like zero?

_____________________________

:)

Follow us on TWITTER

(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 8/26/2009 1:46:08   
Here is my table! "see the attachment" As you can see one person can have more than one appointment! "old or new" I want to sort who does NOT have a new appointment. In my case the query should display the following:

People without appointment are:
Kelly K
Nancy N

The function should check the nextapt of each person to see if it’s older than current day then disply it! Any idea ?



Thumbnail Image
:)

Attachment (1)

< Message edited by box -- 8/26/2009 2:11:51 >

(in reply to TexasWebDevelopers)
swoosh

 

Posts: 1535
Joined: 5/18/2002
From: Beaver Falls, PA
Status: offline

 
RE: Appointments! - 8/26/2009 8:37:17   
SELECT firstname,lastname
FROM TableName
WHERE NextApt<Date()
GROUP BY lastname;

Does that give you what you want?

< Message edited by swoosh -- 8/26/2009 8:46:39 >


_____________________________

Swoooosh
Just Do It!


(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 8/27/2009 0:12:33   
fp_sQry="SELECT firstname,lastname FROM apt WHERE (nextapt < #::todaydate::# ) GROUP BY lastname "

Database Results Error
Description: You tried to execute a query that does not include the specified expression 'firstname' as part of an aggregate function.
Number: -2147217887 (0x80040E21)
Source: Microsoft JET Database Engine

Any Idea?

(in reply to swoosh)
swoosh

 

Posts: 1535
Joined: 5/18/2002
From: Beaver Falls, PA
Status: offline

 
RE: Appointments! - 8/27/2009 9:23:25   
Use ORDER BY instead of GROUP BY.......does that fix it?
My mistake, Group by does not sort them, Order by will.

SELECT firstname,lastname
FROM TableName
WHERE NextApt<Date()
ORDER BY lastname;


< Message edited by swoosh -- 8/27/2009 10:21:49 >


_____________________________

Swoooosh
Just Do It!


(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 8/27/2009 13:48:43   
Hi there, this returns all the appointments! If someone has many old appointments, will display it all! Also the same person might have a future appointment as well! I just want to display one name that does not have today or future appointment! Any idea please

(in reply to swoosh)
TexasWebDevelopers

 

Posts: 722
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: Appointments! - 8/27/2009 14:14:58   
SELECT DISTINCT firstname,lastname
FROM TableName
WHERE nextapt NOT BETWEEN Date() And Date()+3650
ORDER BY lastname;

_____________________________

:)

Follow us on TWITTER

(in reply to box)
swoosh

 

Posts: 1535
Joined: 5/18/2002
From: Beaver Falls, PA
Status: offline

 
RE: Appointments! - 8/27/2009 14:21:57   
Not sure how far into the future your dates are referenced. But TWD's example above using DISTINCT that covers ten years into the future and that should be plenty I would presume:)

_____________________________

Swoooosh
Just Do It!


(in reply to TexasWebDevelopers)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 8/28/2009 2:24:12   
fp_sQry="SELECT DISTINCT firstname,lastname, ptnumber, enrolled FROM appt WHERE ((enrolled = 'AC') AND ('nextapt' NOT BETWEEN (#::todaydate::#) And (#::todaydate::#)+365 )) ORDER BY lastname ASC"


fp_sQry="SELECT DISTINCT firstname,lastname, ptnumber, enrolled FROM appt WHERE enrolled = 'AC' AND 'nextapt' NOT BETWEEN #::todaydate::# And #::todaydate::#+3650 ORDER BY lastname ASC"

Both syntax return same results!!!



For some reasons it returns people with future appointments as well! New appointments wont go more than max 2 months! Is the syntax correct?

< Message edited by box -- 8/28/2009 2:36:13 >

(in reply to swoosh)
swoosh

 

Posts: 1535
Joined: 5/18/2002
From: Beaver Falls, PA
Status: offline

 
RE: Appointments! - 8/28/2009 7:40:59   
Try taking the single quotes away from 'nextapt' and have it as just nextapt

_____________________________

Swoooosh
Just Do It!


(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 8/28/2009 12:42:00   
fp_sQry="SELECT DISTINCT firstname,lastname, ptnumber, enrolled FROM appt WHERE enrolled = 'AC' AND nextapt NOT BETWEEN #::todaydate::# And #::todaydate::#+3650 ORDER BY lastname ASC"

The only difference was I've got 2 records less compare to 'nextapt'! but still displays mixed appointments people with old and new! :)

(in reply to swoosh)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 8/29/2009 23:24:10   
Any idea....:)

(in reply to box)
swoosh

 

Posts: 1535
Joined: 5/18/2002
From: Beaver Falls, PA
Status: offline

 
RE: Appointments! - 8/30/2009 0:48:05   
why do you have:

::todaydate:: instead of date()

_____________________________

Swoooosh
Just Do It!


(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 8/30/2009 1:30:16   
it's a function for date to get this format mm/dd/yyyy, even I have used date() but I've got exact the same result! how weird! I dont know realy what to do!:)

todaydate=<%response.write(fixTheDate(Date()))%>

< Message edited by box -- 8/30/2009 1:36:09 >

(in reply to swoosh)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 9/2/2009 0:57:56   
There is no solution for this?:)

(in reply to box)
TexasWebDevelopers

 

Posts: 722
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: Appointments! - 9/2/2009 8:05:43   
Try doing a response.write on your sql statement and show us what the result is...it's hard to give advice when there are so many different problem areas. For instance, variables, Access column formatting for Date/Time, etc.

_____________________________

:)

Follow us on TWITTER

(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 9/3/2009 0:25:42   
quote:

Try doing a response.write on your sql statement


It should be very EZ to do! but I'm lost tonight! how can I do this pls?

(in reply to TexasWebDevelopers)
TexasWebDevelopers

 

Posts: 722
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: Appointments! - 9/3/2009 8:15:53   
Directly under your sql statement put:

Response.Write(fp_sQry)

_____________________________

:)

Follow us on TWITTER

(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 9/3/2009 15:01:31   
<%
fp_sQry="SELECT DISTINCT firstname,lastname, ptnumber, enrolled FROM appt WHERE ((nextapt NOT BETWEEN #::todaydate::# AND #::todaydate::# +365) AND (enrolled = 'AC')) ORDER BY lastname ASC"
fp_sDefault=""
fp_sNoRecords="<b>No Appointment Found!</b>"
fp_sDataConn="pt"
fp_iMaxRecords=10000
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=8
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<%Response.Write(fp_sQry)%>


and I've got this:

SELECT DISTINCT firstname,lastname, ptnumber, enrolled FROM appt WHERE ((nextapt NOT BETWEEN #::todaydate::# AND #::todaydate::# +365) AND (enrolled = 'AC')) ORDER BY lastname ASC

Then the same results!!!
by the way nextapt is date/time field. Thanks

(in reply to TexasWebDevelopers)
TexasWebDevelopers

 

Posts: 722
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: Appointments! - 9/3/2009 18:20:29   
No, darn it...I'm looking to see what the query looks like after the variables are stuck into it....I can't remember what the full code looks like in FP. Try moving the response.write down the page a bit to someplace after the record set is created. Maybe someone else reading this can help by telling you exactly where to put it...but trial and error works just as well for now...you can't bust anything.

_____________________________

:)

Follow us on TWITTER

(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 9/3/2009 23:12:54   
I put it Further down! the only change is the dates!

SELECT DISTINCT firstname,lastname, ptnumber, enrolled FROM appt WHERE ((nextapt NOT BETWEEN #09/03/2009# AND #09/03/2009# +365) AND (enrolled = 'AC')) ORDER BY lastname ASC


(in reply to TexasWebDevelopers)
TexasWebDevelopers

 

Posts: 722
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: Appointments! - 9/4/2009 1:04:23   
OK the result you want is -- BETWEEN 09/03/2009 AND 09/03/2010
Try removing the # from the sql statement and if that won't work then keep the # and remove the ::
Play with it.

_____________________________

:)

Follow us on TWITTER

(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 9/4/2009 1:56:54   
I tried different possibilities but this doesn’t want to work I guess!

#todaydate#
Database Results Error
Description: Syntax error in date in query expression '((nextapt NOT BETWEEN #todaydate# AND #todaydate# +365) AND (enrolled = 'AC'))'.
Number: -2147217913 (0x80040E07)

'todaydate'
Database Results Error
Description: Data type mismatch in criteria expression.
Number: -2147217913 (0x80040E07)

::todaydate::
The same mixed result!

(in reply to box)
TexasWebDevelopers

 

Posts: 722
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: Appointments! - 9/4/2009 12:56:10   
So quit using the function fix...it's already in the correct format...use Date() instead of todaydate...and there is something you didn't check...todaydate without any punctuation around it

_____________________________

:)

Follow us on TWITTER

(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 9/4/2009 16:04:31   
todaydate

Database Results Error
Description: No value given for one or more required parameters.
Number: -2147217904 (0x80040E10)


Date()

SELECT DISTINCT firstname,lastname, ptnumber, enrolled FROM appt WHERE ((nextapt NOT BETWEEN date() AND date() +365) AND (enrolled = 'AC')) ORDER BY lastname ASC

(in reply to TexasWebDevelopers)
TexasWebDevelopers

 

Posts: 722
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: Appointments! - 9/4/2009 17:44:50   
post the page code

_____________________________

:)

Follow us on TWITTER

(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Appointments! - 9/5/2009 1:21:09   
<%
fp_sQry="SELECT DISTINCT firstname,lastname, ptnumber, enrolled FROM appt WHERE ((nextapt NOT BETWEEN date() AND date() +365) AND (enrolled = 'AC')) ORDER BY lastname ASC"
fp_sDefault=""
fp_sNoRecords="<b>No Appointment Found!</b>"
fp_sDataConn="pt"
fp_iMaxRecords=10000
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=8
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>


Even I tried the following still I'm getting the same mixed results! what is causing this? I'm confused.

fp_sQry="SELECT DISTINCT firstname,lastname, ptnumber, enrolled FROM appt WHERE enrolled = 'AC' AND [nextapt] NOT BETWEEN #" & request.form("StartDate") & "# And #" & request.form("EndDate") & "# ORDER BY lastname ASC"


SELECT DISTINCT firstname,lastname, ptnumber, enrolled FROM appt WHERE enrolled = 'AC' AND [nextapt] NOT BETWEEN #09/05/2009# And #09/05/2010# ORDER BY lastname ASC

The point is even if this query works right but still will show the appointments prior of starting date as well! In this case "NOT BETWEEN #09/05/2009# And #09/05/2010#" will show still appointments prior 09/05/2009!

< Message edited by box -- 9/5/2009 22:43:29 >

(in reply to box)
Page:   [1] 2   next >   >>

All Forums >> Web Development >> ASP, PHP, and Database >> Appointments!
Page: [1] 2   next >   >>
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts