Results 1 to 2 of 2
  1. #1
    NISMOJim is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2010
    Posts
    273

    Unrepeatable problem

    Hello,

    I'm having a problem with my latest database. One of the users keeps getting an error message that I can't duplicate. The form (frmVisit) is tied to qryVisit, tied to tblVisit. cboVstrName is the control to enter a visitors name, and has a row source of qryVstr, which is just a list of visitors names. The Limit to List is set to Yes, and the NotInList code looks like this...

    Private Sub cboVstrName_NotInList(NewData As String, Response As Integer)
    'Adds visitor name to table if not already on dropdown list
    Dim strSQL As String
    Dim Compy As String
    Compy = Nz(Me.cboVstrComp)

    NewData = StrConv(NewData, vbProperCase)

    DoCmd.SetWarnings False
    strSQL = "INSERT INTO tblVstr (VstrName, VstrCmpny)"
    strSQL = strSQL & "VALUES ('" & NewData & "', '" & Compy & "');"
    DoCmd.RunSQL strSQL
    DoCmd.SetWarnings True
    Response = acDataErrAdded

    End Sub

    When I enter a name in the combobox that isn't already in the source table, the first & last names are capitalized, and they are saved in tblVstr, and the data is correctly saved in tblVisit. I've entered 2 pages of names with no problems or errors. Today I watched one of the users enter names (the exact same way I was entering them), and after 2 or 3 entries, she would get a message on the cboVstrName control saying something like "the value you entered is not in the list. You must enter a value from the list." I entered another page of names tonight, and never got the message at all, everything worked perfectly.
    Any suggestions?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    instead of using code, cant you just assign a query to the combo, where this query pulls the items available?
    (instead of constantly rewriting the table)?

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

Similar Threads

  1. Replies: 9
    Last Post: 07-06-2015, 01:47 AM
  2. Replies: 2
    Last Post: 10-31-2012, 11:52 AM
  3. Replies: 2
    Last Post: 06-14-2010, 03:25 PM
  4. query problem i have a problem wi
    By maxx3 in forum Queries
    Replies: 0
    Last Post: 06-29-2009, 02:29 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