I think that the problem is that the #'s in the SQL are not working with a column that has a date or date/time data type. Try this:
Dim mm as Long
Dim dd as Long
mm = Month(Date)
dd = Day(Date)
Set cn = New ADODB.Connection
With cn
.ConnectionString = "Provider=SQLOLEDB.1;Persi
Catalog=bla;Data Source=xxx.com"
.Open
End With
Set rp = New ADODB.Recordset
With rp
.Source = "SELECT * FROM members where MONTH(birthday) = " & mm & " AND DAY(birthday) = " & dd
.ActiveConnection = cn
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open Options:=adCmdText
Do While Not .EOF
Debug.Print .Fields(1)
.MoveNext
Loop
Main Topics
Browse All Topics





by: PBuckPosted on 2001-12-28 at 07:31:43ID: 6698767
If I remember correctly you place date fields within (#) pound signs - so change the following.
.Source = "SELECT * FROM members where birthday like '####-" & rech & "'"
.Source = "SELECT * FROM members where birthday like #" & rech & "#"
or with what you are trying to do:
.Source = "SELECT * FROM members where birthday like #????-" & rech & "#"
-Whew it has been awhile for me and SQL :-) Just make sure the date criteria is within (#).
Hope this helps!