I am currently updating my db via a form using the following code: Forms!FMSUpdate!Message.Value = "Here it is". What is the syntax to update the table directly instead of going through the form. Thanks
You could use some code such as this placed on a Save command button:
Private Sub notebox_OnClick()
Dim DB As DAO.Database
Dim RS As DAO.Recordset
Dim strWhere As String
Set DB = CurrentDb()
Set RS = DB.OpenRecordset("YourtableName", dbOpenDynaset)
strWhere = "[PrimaryKey] = " & Me![PrimKeyOnForm]
RS.FindFirst strWhere
If RS.NoMatch Then
MsgBox "No match found"
Else
RS.Edit
RS![FieldToUpdate] = Me![FieldOnForm]
RS.Update
End If
RS.Close
DB.Close
Set RS = Nothing
Set DB = Nothing
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.