title: on Button press If(No record exist) Then create Else Update
body: <p>I have an unbound form. On the form i have a save button. As of now when you press the save button it saves the information on the form to a record, but every time you press save it adds a new record instead of updating it. I need it to Update the current record instead of adding a new record. Any ideas is appreciated.</p>
  
  <p>here is my code:</p>
  
  <pre><code>Dim dblocal As DAO.Database
  Dim rst As DAO.Recordset
  
  Set dblocal = CurrentDb()
  Set rst = dblocal.OpenRecordset("SUBJECT_DATABASE", dbOpenDynaset)
  
  'Prim. ID var.
  Dim EvtIDkey As Long
  
  With rst
  .AddNew
  .Fields("LAST NAME") = Me.LNameTxtB
  .Fields("FIRST NAME") = Me.FNameTxtB
  .Fields("GENDER") = Me.GenderCboB
  .Fields("DOB") = Me.DOBTxtB
  
  
  'inserts primary id into textB
  Me.EvtIDKeyTxtB = .Fields("ID")
  
  .Update
  End With
  
  End If
  </code></pre>
  
  <p>I was thinking to add a if statement with the following conditions:
  If EvtIDKeyTxTB is not empty update exist record. However, how do i update an existing record?</p>
  
  <p>If i have the Primary key would i be able to get and update the record that way? </p>