|
-
Jul 28th, 1999, 01:54 AM
#1
how exactly do i count the records in a table by a date.
the date is entered as a number long
yyyymmdd
i want to use a variable for the date
any help is greatly appreciated
-
Jul 28th, 1999, 07:18 AM
#2
Fanatic Member
I can't exactly know what you mean...
But maybe this will help...
Try to save the date in a variable...
then..
Open the table which date is same with the contents in that variable.
If, open succesful (Records found), then, you loop it....
e.g :
dim vardate as date
vardate=datefield
MyConn.Open "DSN=dsnName"
MyRec.Open "select * from tablename where datefield = '" & vardate & "'", MyConn, adOpenDynamics, adLockOptimistic, adCmdText
If (MyRec.BOF<>True) and (MyRec.EOF<>True) then
MyRec.MoveFirst
RecCounter = 0
Do While Not MyRec.EOF
RecCounter = RecCounter + 1
MyRec.MoveNext
Loop
Else
msgbox "Record not found"
Endif
MyRec.Close
I hope it would Help you......
Ciaooooo
Best Regards,
Wen Lie
-
Aug 2nd, 1999, 07:29 PM
#3
New Member
There is an much easier way - "SELECT count (*) FROM " & tablename & " WHERE date=" & date.
With this statement you will get a recordset with just one entry - the recordcount
-
Aug 3rd, 1999, 01:11 PM
#4
Junior Member
Answer wich MartinE gave you isn´t just much easier but also more effective and faster way of counting recordsets.
Jan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|