Thanks. I'll ASSUME they don't have too many...but I really can't answer this accurately.
Dian ~ -----Original Message----- From: David Smart [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 6:40 PM To: [EMAIL PROTECTED] Subject: Re: [ASP] Need a little "logic" To get the most recent few records (or 1 of course) when you have a time/date stamp in the records, I use select top 10 [whatever fields] from [whatever table] where [whatever selections] order by [whatever timestamp] desc I assume a "select top 1" would actually find all the transactions for the customer, then only return you the latest one (after the descending sort). This may not be efficient enough for your purposes, but if each customer only has a smallish number of transactions, you may not care. Dave S ----- Original Message ----- From: Dian Chapman To: [EMAIL PROTECTED] Sent: Friday, June 25, 2004 4:28 AM Subject: [ASP] Need a little "logic" Hi folks... I'm acutally working on a Word/DB Automated form...but it's the same logic. And right now that's exactly what I need... I have a CustomerTbl and TransactionTbl. (This is a DB form for a bank.) I want to be able to capture the LAST transaction so I can populate the Word custom dialog box with the details of the last transaction. What would you say is the best way to capture the last transaction info? And help with code would be mighty helpful, too! <cheesy grin> It's a OneToMany relationship between the customer table and the transaction table. I have the date of the transaction...but think it might be easier to just capture the last record for that person? Since I'll need to run a query to join up the tables to find all the transactions for that customer, anyway...I'm GUESSING that I could find out the highest record number in that query??? That would be the record for the last transaction and then I could use that to create the RS for the dlg population? My other thought is to...at the time the transaction goes into the transaction table...I'll have the customer's record available anyway...so maybe I should just capture the new transaction record number and pass that into a field in the customer table? Then...when I need that default info from the last, I could just grab the number from that LastTransactionNo field and run a query for that record? I don't know? But then...that's why I'm asking the experts here cos' I'm somewhat at a loss for what might be the most sensible route to go. Note...that this is just a Word form passing data between a simple Access DB...no SQL or transaction server involved here! TIA... Dian ~ (And yes Ray...I know I owe you a reply about another matter...I'm working on it!) --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.710 / Virus Database: 466 - Release Date: 23/06/2004 [Non-text portions of this message have been removed] --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [EMAIL PROTECTED] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.710 / Virus Database: 466 - Release Date: 6/23/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.710 / Virus Database: 466 - Release Date: 6/23/2004 ------------------------ Yahoo! Groups Sponsor --------------------~--> Yahoo! Domains - Claim yours for only $14.70 http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/17folB/TM --------------------------------------------------------------------~-> --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [EMAIL PROTECTED] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/active-server-pages/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
