|
-
Nov 26th, 1999, 04:03 AM
#1
Thread Starter
Lively Member
I want to open a recordset based on the latest date of a few records.
So far I have:
set rst = DB.OpenRecordset("select *from [prices] where [Company number]=" & company_number & " AND [product number] =" & product_num ).
I'm not sure how to fit in the clause that specifies the latest date.
Thanks for your time.
Danny.
-
Nov 26th, 1999, 07:10 AM
#2
Addicted Member
Hi there...
You could have a 3rd txtbox named say: Latest. In it you could enter the date you want to check. Also add a field to your tabel named Latest. So your SQL would be:
(select * from prices where Company number= company_number AND product number = product_num And latest >= #Latest# ).
G Luck
-
Nov 26th, 1999, 07:57 AM
#3
Thread Starter
Lively Member
I already have a field in my table that specifies the
date when the price was set .
the problem is after selcting my records via company number and product number I have a few records in my recordset (each with a differnt date of when I set the price for the perticular company) I want to get the record with the latest date with out knowing what the latest
is.
I am trying to do it in the sql statment.
Is there a way?
Thanks.
Dan.
-
Nov 27th, 1999, 01:07 AM
#4
Junior Member
Let's try :
_____________________________
set rst = DB.OpenRecordset("select *from [prices] where [Company number]=" & company_number & " AND [product number] =" & product_num order by (yourdatefieldname) DESC).
You will get many record but the first record is the record that have latest date.
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
|