Update Table from an unbound form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to update a table from an unbound form? I can do this and
append data to a table but in this case, I already have data in the table and
want to update 2 or 3 fields in a specific record in a specific table.
Thanks for the help....
 
Sure, it is exactly the same, except you don't use the .AddNew. You just
have to position your table so the record you want to update is the current
record.
rstMyRecSet![SOME_STUFF] = Me.txtSomeStuff
rstMyRecSet![OTHER_STUFF] = Me.txtOtherStuff
rstMyRecSet.Update
 
Another way is to use RunSQL:

strFormFieldName=Me.FormFieldName
DoCmd.RunSQL "UPDATE [MyTable] SET [FieldName] = '" & strFormFieldName &
"'"

or
iFormFieldName=Me.FormFieldName
DoCmd.RunSQL "UPDATE [MyTable] SET [FieldName] = " & iFormFieldName & "
 
Back
Top