Date Difference between consecutive rows

SELECT T1.ID, T1.AccountNumber, T1.Date, MIN(T2.Date) AS Date2, DATEDIFF(“D”, T1.Date, MIN(T2.Date)) AS DaysDiff FROM YourTable T1 LEFT JOIN YourTable T2 ON T1.AccountNumber = T2.Accountnumber AND T2.Date > T1.Date GROUP BY T1.ID, T1.AccountNumber, T1.Date; or SELECT ID, AccountNumber, Date, NextDate, DATEDIFF(“D”, Date, NextDate) FROM ( SELECT ID, AccountNumber, Date, ( SELECT MIN(Date) FROM YourTable T2 WHERE T2.Accountnumber … Read more

Code to loop through all records in MS Access

You should be able to do this with a pretty standard DAO recordset loop. You can see some examples at the following links: http://msdn.microsoft.com/en-us/library/bb243789%28v=office.12%29.aspx http://www.granite.ab.ca/access/email/recordsetloop.htm My own standard loop looks something like this: Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset(“SELECT * FROM Contacts”) ‘Check to see if the recordset actually contains rows If Not … Read more

How to add default signature in Outlook

The code below will create an outlook message & keep the auto signature Dim OApp As Object, OMail As Object, signature As String Set OApp = CreateObject(“Outlook.Application”) Set OMail = OApp.CreateItem(0) With OMail .Display End With signature = OMail.body With OMail ‘.To = “someone@somedomain.com” ‘.Subject = “Type your email subject here” ‘.Attachments.Add .body = “Add … Read more

Difference between Microsoft.Jet.OleDb and Microsoft.Ace.OleDb

It’s mainly a matter of history, effectively ACE has superceded JET: Wikipedia answers your question in great detail. The most relevant sections are: With version 2007 onwards, Access includes an Office-specific version of Jet, initially called the Office Access Connectivity Engine (ACE), but which is now called the Access Database Engine. This engine is fully … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)