See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.
Option Compare Database Private Sub Form_Load() ' Declare database object and recordset objects. Dim db As Database, rst As Recordset, rstFrm As Recordset ' Set the database object to the current database. Set db = CurrentDb ' Open the table tblStorage. Set rst = db.OpenRecordset("tblStorage") ' Set the index for the seek. rst.Index = "PrimaryKey" ' Look for the MainIDLast record. rst.Seek "=", "MainIDLast" ' If a match, get the customer ID and take the form to that ' record. If no match, do nothing. If Not rst.NoMatch Then If Not IsNull(rst![Value]) Then ' Create clone of the form's record set. Set rstFrm = Me.RecordsetClone ' Find the matching record. rstFrm.FindFirst "[MainID] = '" & rst![Value] & "'" If Not rstFrm.NoMatch Then ' Have the form go to that matching record. Me.Bookmark = rstFrm.Bookmark End If rstFrm.Close ' Close the recordset rstFrm. End If End If rst.Close ' Close the recordset rst. End Sub Private Sub Form_Unload(Cancel As Integer) ' The code below finds or creates a record in tblStorage where the ' field Variable contains "MainIDLast", and stores the current ' MainID in the field called Value. ' Declare database object and recordset object. Dim db As Database, rst As Recordset ' If the current record has no customer ID, do nothing. If IsNull(Me![MainID]) Then Exit Sub Set db = CurrentDb Set rst = db.OpenRecordset("tblStorage") rst.Index = "PrimaryKey" rst.Seek "=", "MainIDLast" ' If not found, create the entry. If rst.NoMatch Then rst.AddNew rst![Variable] = "MainIDLast" rst![Value] = Me![MainID] rst![Description] = "ID of last edited customer record," _ & Me.Name & "." rst.Update ' Update the recordset. Else ' Else save the customer ID of the current record. rst.Edit rst![Value] = Me![MainID] rst.Update ' Update the recordset. End If rst.Close ' Close the recordset. End Sub
|Excel as MS Access front end||11||77|
|is it possible to create a function in access and use it in a query?||7||33|
|Microsoft Access performance is slow||10||45|
|SQL syntax error in VBA||11||16|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
11 Experts available now in Live!