[AccessD] form doesn't save

Susan Harkins ssharkins at gmail.com
Wed Oct 31 15:42:35 CDT 2007


The following is a simple event procedure that updates a value list combo with user input. It works fine. The problem is, the form won't save the new item. The next time you open the form, the newly added item's gone. It's kind of like, the form doesn't think there's anything to change, because I don't get the Save prompt. 

Susan H. 



Private Sub cboMetals_NotInList(NewData As String, _
 Response As Integer)
  'Update value list with user input.
  On Error GoTo ErrHandler
  Dim bytUpdate As Byte
  bytUpdate = MsgBox("Do you want to add " & _
   cboMetals.Value & " to the list?", _
   vbYesNo, "Non-list item!")
  'Add user input
  If bytUpdate = vbYes Then
    Response = acDataErrAdded
    cboMetals.AddItem NewData
    'Update RowSource property for
    'XP and older.
    'cboMetals.RowSource = _
    ' cboMetals.RowSource _
    ' & ";" & NewData
    'Save updated list.
    DoCmd.Save acForm, "ValueList"
  'Don't add user input
  Else
    Response = acDataErrContinue
    cboMetals.Undo
  End If
  Exit Sub
  
ErrHandler:
  MsgBox Err.Number & ": " & Err.Description, _
   vbOKOnly, "Error"
  
End Sub



More information about the AccessD mailing list