ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 23rd, 2004, 04:12 PM
DanDan256 DanDan256 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 6 DanDan256 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
DateDiff, Query,

I'm trying to find out who in my Database is over 18 from the current date.
I have two tables in Access:- Household and Resident
I have formatted both dates, age1 and ShortGB to
dd/mm/yyyy,
I keep getting a Data type mismatch error,
Is there a way round my problem? I've been looking for two days now!

<% MyDate = Date()
Locale = SetLocale(2057)
ShortGB = FormatDateTime(MyDate, 2)

set RS1 = dbConn.Execute("Select DOB as age from Resident")

do until RS1.EOF

age1 = RS1("age")
Set RS2 = dbConn.Execute( "Select Name, Address, PostCode from resident, Household where DateDiff('YYYY', 'age1' , '"&ShortGB&"') >18 and resident.Household_ID = Household.Household_ID" )

Name =RS1("Name")
addy =RS1("Address")
PC =RS1("PostCode")

Response.write(Name)
Response.Write(addy)
Response.Write(PC)

Loop
%>

Thanks for your time!
Dan,

Reply With Quote
  #2  
Old February 23rd, 2004, 04:14 PM
DanDan256 DanDan256 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 6 DanDan256 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sorry....

Sorry, i forgot to say.
Its the RS2 Query that i'm having problems with!
DateDiff('YYYY', DateOfBirth, CurrentDate)
is my syntax correct?
Thanks
Dan,

Reply With Quote
  #3  
Old February 25th, 2004, 07:31 AM
jonnymccullagh jonnymccullagh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Ireland
Posts: 241 jonnymccullagh User rank is Lance Corporal (50 - 100 Reputation Level)jonnymccullagh User rank is Lance Corporal (50 - 100 Reputation Level)jonnymccullagh User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 20 h 13 m 47 sec
Reputation Power: 5
I'm in ahurry to get my lunch but would this help?

targetDate = cdate(month(DateAdd("YYYY", -18, Now)) & "/" & day(DateAdd("YYYY", -18, Now)) & "/" & year(DateAdd("YYYY", -18, Now)) )

then in the SQL do something like this:

SELECT * FROM tblUsers WHERE DOB>=#" & targetDate & "#
__________________
"We teach people to learn,
we never teach them how to grow" - Oscar Wilde

Reply With Quote
  #4  
Old February 25th, 2004, 12:00 PM
Ed1984 Ed1984 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 1 Ed1984 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Wink

thankyou so much for your help!
it works perfectly
DanDan says cheers too.
you dont know how long we have been trying to get that right for!
Thankyou again

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > DateDiff, Query,


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT