Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005

    Unanswered: Search function.

    I have a drop down box on my form that searches for a name in the database and brings up the selected name. If the name is not in the list, I get the standard microsoft dialogue box: The text you entered isn't in the list, select an item from the list....etc. However, I don't want that box, I want a message box that says "The text isn't in the list, press the ok button to create a new entry (at this point I want the form to open in add mode) or Cancel.

    I don't want them to be able to add a new customer until they've checked whether there is an existing customer first.

    Currently my code looks like this:-

    stDocName = "fpriContacts"

    strContactID = Me!cboNaSelect

    DoCmd.OpenForm stDocName, , , , acFormEdit, , strContactID

    strmainContactID = Forms!fpricontacts!CONTACTID

    DoCmd.FindRecord strContactID, , True, , True, , True


  2. #2
    Join Date
    Jan 2005
    the trick to using the not in list function is to let the combo box know that the data was added. when you open a not in list event you should see something like this

    Private Sub ComboBox_NotInList(NewData As String, Response As Integer)

    i add a function which opens an input form and returns whether the user added a new record or clicked cancel.
    Response is the variable the combo box uses to see if the data was added. provided the user did add a new record set response to acDataErrAdded. Access will then requery the combo box.

    hope this helps

Posting Permissions

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