Prev: DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8
Next: Page-Index of a Tab-Control from a SubForm
From: felton on 3 Mar 2010 17:22 I am keying in data into a results table and I need to setup a checking process during the data entry so that each new results record is dated is after, not before or equal to, the date in the previous records. Does anyone know how to set this up? In other words, I need Access to prevent both an earlier date or the same date already entered from any previous records. Many thanks.
From: PieterLinden via AccessMonster.com on 3 Mar 2010 18:23
felton wrote: >I am keying in data into a results table and I need to setup a checking >process during the data entry so that each new results record is dated is >after, not before or equal to, the date in the previous records. Does anyone >know how to set this up? In other words, I need Access to prevent both an >earlier date or the same date already entered from any previous records. > >Many thanks. You would have to use some code in the BeforeInsert event and use DMAX to get the latest date and make sure the one being entered was greater than that... Private Sub Text2_BeforeUpdate(Cancel As Integer) If Me.Text2 <= DMax("ReportDate", "tblNonNormal") Then MsgBox "Has to be later all other entries", vbOKOnly + vbInformation Cancel = True End If End Sub -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1 |