Results 1 to 4 of 4
  1. #1
    dinsey90 is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    29

    Not in list wont open message box


    Hi I have tried entering the below code which i got from a you tube video on how to do a not in list code to open a form and add the client to the list. the problem is when i type in to the combo box and hit enter it just allows the new info and doesn't add it to my clients table.

    Code:
    Private Sub Client_Name_NotInList(NewData As String, Response As Integer)
    Dim MsgBoxAnswer As Variant
    
    
    Response = acDataErrContinue
    
    
    MsgBoxAnswer = MsgBox("Client not in list. Do you want to add this client?", vbYesNo)
    
    
    If MsgBoxAnswer = vbNo Then
        Me.Client_Name = Null
        DoCmd.GoToControl "Client_Name"
        GoTo exitline
    Else
        txtHiddenField = "AddOK"
        DoCmd.OpenForm ("frmAddClient")
        DoCmd.GoToRecord , , acNewRec
        Forms![frmNewQuote]![Client_Name] = NewData
        Me.Client_Name = Null
        DoCmd.GoToControl "Description"
    End If
    
    
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    You open frmAddClient but then you populate field on frmNewQuote - should be frmAddClient.

    Set a breakpoint and step debug.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    dinsey90 is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    29
    Thanks June, the problem is though it doesnt even open a message box when i enter a name thats not in the list, its as if the code isnt even running? Once i type in a name that isnt in the list and hit enter it just goes on to the next cell in the form as if there is no code under Notinlist :/

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Make sure the combobox NotInList event property has [Event Procedure]. Also, LimitToList property must be Yes.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Switchboard wont open Return without go sub error
    By kiwikiki718 in forum Access
    Replies: 2
    Last Post: 04-10-2017, 07:05 PM
  2. file on network wont open
    By sbrady19 in forum Access
    Replies: 10
    Last Post: 03-11-2015, 07:58 AM
  3. reports wont open
    By jamo in forum Reports
    Replies: 3
    Last Post: 10-15-2012, 05:56 AM
  4. Replies: 4
    Last Post: 03-06-2012, 12:53 PM
  5. Database wont open
    By sarah54 in forum Access
    Replies: 22
    Last Post: 12-08-2010, 08:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums