You didn't give the SQL statement to the RunSQL command:
Private Sub CmdLastUsedRecord_Click()
Dim strSQL As String
strSQL = "UPDATE UsystblApplication SET [Number]= " _
& txtLastUsedRecordProject _
& " WHERE UsystblApplication.Number= &
Me.txtLastUsedRecordProject"
DoCmd.RunSQL strSQL
End Sub
By the way, our recommendation here would be to use the .Execute method of
the CurrentDb object because it will let you trap for errors:
Private Sub CmdLastUsedRecord_Click()
Dim strSQL As String
Dim dbs As DAO.Database
strSQL = "UPDATE UsystblApplication SET [Number]= " _
& txtLastUsedRecordProject _
& " WHERE UsystblApplication.Number= &
Me.txtLastUsedRecordProject"
Set dbs = CurrentDb
dbs.Execute strSQL, dbFailOnError
dbs.Close
Set dbs = Nothing
End Sub
--
Ken Snell
<MS ACCESS MVP>
"bobdydd" <re**************@yahoo.co.ukwrote in message
news:11**********************@o40g2000prh.googlegr oups.com...
Hi All
Access 2007 Windows XP
I have a table called:
UsystblApplication
Which has 2 fields called:
1. FieldName
2. Number
I want to be able to Update the reccord from a form which
has a control called:
1. Me.txtLastUsedRecordProject
And do it from a Command Button. I am using the code below,
and although I get the warning that I won't be able to undo it.
It just doesn't not alter. Here is the code I am using
Can anyone help?
Private Sub CmdLastUsedRecord_Click()
Dim strSQL As String
strSQL = "UPDATE UsystblApplication SET [Number]= " _
& txtLastUsedRecordProject _
& " WHERE UsystblApplication.Number= &
Me.txtLastUsedRecordProject"
DoCmd.RunSQL
End Sub