Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002

    Unanswered: NotInList problem

    Greetings to all who would help me with this issue.

    On NotInList event in my combo Box I go to a form for the user to add the new value.
    When I go back to the primary form it tells me that the item is not in the list and takes me back to the form to add, what it thinks, is a value that is not in the table.

    I placed a cmd button on the form, which will refresh the forms data, and will the display the added value in drop down of the combo box.

    Is there anyway I refresh the forms data, or the combo box itself, without the use of the command button? Either blanking out the value, but allow the to see it in the list, or for the value itself to be recognized.

    Any help is appreciated.

  2. #2
    Join Date
    Sep 2004
    Tampa, FL
    I am slighty unclear about the whole issue but...
    Does the button accomplish the goal you are looking for?
    If it does could you not add it to the onclose event of the add a new item form ?

  3. #3
    Join Date
    Sep 2003
    izyrider and myself have posted on this topic specifically in the past... Try doing an advanced search for notinlist ...
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    Feb 2005
    Try this (or a variation on it to suit yourself):
    Dim intNewGroup As Integer, intTruncateName As Integer, intMsgDialog As Integer
    Dim strTitle As String

    ' Display message box asking if user wants to add a new category.
    strTitle = "Group Not In List"
    intMsgDialog = vbYesNo + vbQuestion + vbDefaultButton1
    intNewGroup = MsgBox("Do you want to add a new Group?", intMsgDialog, strTitle)

    If intNewGroup = vbYes Then
    ' Remove new name from CategoryID combo box so
    ' control can be requeried when user returns to form.
    DoCmd.RunCommand acCmdUndo

    ' Display message box and adjust length of value entered in
    ' CategoryID combo box.
    strTitle = "Name Too Long"
    intMsgDialog = vbOKOnly + vbExclamation
    If Len(NewData) > 50 Then
    intTruncateName = MsgBox("Group names can be no longer than " _
    & "50 characters. The name you entered will be truncated.", _
    intMsgDialog, strTitle)
    NewData = Left$(NewData, 50)
    End If

    'Update immediately - no point calling a newUnit form as there is only
    'one field to update!
    DoCmd.SetWarnings False
    DoCmd.RunSQL "Insert into Groups ([Group]) values ('" & NewData & "')"
    DoCmd.SetWarnings True

    Response = acDataErrAdded
    Response = acDataErrContinue
    SendKeys ("{ESC 2}")
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts