Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Location
    LA, CA
    Posts
    54

    Question Unanswered: Add record if not in combo box? oh did i mention it's in a subform?

    Hi folks... so my dad wants an opera recordings database that tracks information about the opera recording itself and then what opera singers perform on each.... i have 3 tables (that you care about)... table 1- recordings; table 2- artist (name of the artists... has an autonumber for key field) 3) linking table that matches the artist to the recording and what role they played (don't ask... my dad felt he needed this as a database).... i created a form for him to enter artist info and a form to enter recording info with a subform to enter artists and which specific role they sang...

    so here is my question...
    because it's a subform, i am having trouble having NEW artists created from it. Is there a clever way to say "if this artists isn't in the list (null), create one...."? Maybe i have been looking at this too long. The bound column is the autonumber....

    I hope this makes sense...

    Rachel

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Probably the most common method is to use the Not in List event of the combo, combined with the Limit to List property. Searching here for "notinlist" should turn up the two basic methods.
    Paul

  3. #3
    Join Date
    Jun 2005
    Posts
    36
    In this case I would use a Insrt Into in the NotInList event
    Dim strSQL As String

    strSQL = "INSERT INTO tblAartist([ArtisInfo1],[ArtisInfo1],[ArtisInfo1],[ArtisInfo1],[AndSoOn])" _
    & "VALUES ('" & NewData & "','','','','','')"
    DoCmd.SetWarnings False
    DoCmd RunSQL strSQL
    DoCmd.SetWarnings True
    Response = acDataErrAdded

Posting Permissions

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