Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filtering people with birthday in a range

Status
Not open for further replies.

elbel

Programmer
Dec 6, 1999
8
IT
Hello, I'm Elena from Italy. I have an Access table with people records and with birthdate as a date field. Using VB6 and ado, I need to filter people who have their birthday in a range supplied from the user in two textboxes. I'm not able to create a recordset with these records. I've tried to generate a query in Access (I amable to do it) and to call it from VB or to copy the sql string in a vb command, but it doesn't work. Did anybody solve this problem?<br><br>Thank you.<br><br>Elena<br>Italy
 
<br>Generally speaking, when referring to date fields in access (within SQL), you have to surround the date values with # sign.&nbsp;&nbsp;For example,<br><br>SELECT * FROM Employees WHERE HireDate &lt; #01/01/2000#<br><br>I hope this helps!
 
O.K. But I need some photographs of the Italian Countryside to show my friends.<br><br><br>Function MakeNiceQuery(startDate as date, endDate as date) as String<br><br>Dim strSQL as string <br>Dim a&nbsp;&nbsp;as string <br>Dim b sting<br><br>a = startDate<br>b = endDate<br><br>strSQL=&quot;SELECT * from [people_records] where&nbsp;&nbsp;[people_records].[birthdate] &gt;= #&quot;&nbsp;&nbsp;& a & &quot;# and [people_records].[birthdate] &lt;= #&quot;&nbsp;&nbsp;& b & &quot;#;&quot;<br><br>MakeNiceQuery = strSQL<br><br>End Function<br><br><br>O.k. Now send pictures ! : )<br><br><br><br><br><br><br> <p>Amiel<br><a href=mailto:amielzz@netscape.net>amielzz@netscape.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top