Bill Garrett
July 18th, 2001, 03:00 PM
Hello again everyone. I got the help I needed last time, but now another problem has popped up. I am using the following code to update the "last person to update" field. For some reason, it takes the current user's name (database is MS Access 2002), and puts the user's name is EVERY record in the field. Is there a way to specify to ONLY put the name in the record that is currently on the screen in Access? Maybe passing the variable from Access somehow, and searching, or something? Or am I not going to be able to do this?
CODE:
Private Sub SAVE_RECORD_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Dim colItems As Items
Dim tblContacts As Recordset
Dim upContactId As UserProperty
Dim strMessage As String
Dim strTableName As String
Set db = OpenDatabase("c:\sulphur db\sulphur2002.mdb")
'Open the table.
Set tblContacts = db.OpenRecordset("Contacts", dbOpenDynaset)
sSQL = "update Contacts set Last_Person = '" & CurrentUser() & "'"
db.Execute sSQL
End Sub
Thanks!
Bill Garrett
CODE:
Private Sub SAVE_RECORD_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Dim colItems As Items
Dim tblContacts As Recordset
Dim upContactId As UserProperty
Dim strMessage As String
Dim strTableName As String
Set db = OpenDatabase("c:\sulphur db\sulphur2002.mdb")
'Open the table.
Set tblContacts = db.OpenRecordset("Contacts", dbOpenDynaset)
sSQL = "update Contacts set Last_Person = '" & CurrentUser() & "'"
db.Execute sSQL
End Sub
Thanks!
Bill Garrett