Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Delta, Br. Columbia
    Posts
    116
    Thanks
    1
    Thanked 0 Times in 0 Posts

    notinList event adding two records

    I have a combo box based upon a query. Limit to List is set to yes and the On Notinlist event allows the user to add a new record if they wish. The problem is that the new record is being added twice and I cannot find out where or why. I have attached a sample database with the form and code.

    Any ideas.
    Attached Files Attached Files

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    You have one table too few.
    Your OnNotInList event is adding a record to tabCustomersiteIDs but that is the job done by the subform. So the On Not in List code creates a record, then the fact that you are adding a record to the subform creates the second record.

    You need a Sites table, with the combo drawing values from that table. The OnNotInList code would then add a site to that table, and the subform would add a record to tabCustomersiteIDs.
    Regards
    John



  3. #3
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Delta, Br. Columbia
    Posts
    116
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks John, that solved the problem perfectly. I now create a tmp table of CustSiteIDs in the onOpen event and use that in the combo box. I can then copy some of the info from the site selected into the new record in tabCustomerSiteIDs.

Posting Permissions

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