Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2007
    Posts
    38

    Unanswered: What is wrong with this code?

    I have been using a database with the following code for a few years and now all of a sudden I am getting an error - any ideas?

    Private Sub cmboSire_NotInList(NewData As String, Response As Integer)
    On Error GoTo cmboSire_NotInList_Err
    Dim intAnswer As Integer
    Dim strSql As String
    intAnswer = MsgBox("The sire " & Chr(34) & NewData & Chr(34) & " is not currently listed." & vbCrLf & "Would you like to add it to the list now?", vbQuestion + vbYesNo, "Sires")
    If intAnswer = vbYes Then
    strSql = "INSERT INTO Sire([Name]) " & "VALUES ('" & NewData & "');"
    DoCmd.SetWarnings False
    DoCmd.RunSQL strSql
    DoCmd.SetWarnings True
    MsgBox "The new sire has been added to the list.", vbInformation, "Sire"
    Response = acDataErrAdded
    Else
    MsgBox "Please choose a sire from the list.", vbInformation, "Sire"
    Response = acDataErrContinue
    End If
    cmboSire_NotInList_Exit:
    Exit Sub
    cmboSire_NotInList_Err:
    MsgBox Err.Description, vbCritical, "Error"
    Resume cmboSire_NotInList_Exit
    End Sub

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by kim burke View Post

    ...I have been using a database with the following code for a few years and now all of a sudden I am getting an error - any ideas...
    Here's an idea; tell us what error is occurring and what line is being highlighted when it pops! This might help us help you!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Aug 2007
    Posts
    38
    This is the error (sorry should have included the first post)

    Compile error:
    Ambiguous name detected



    See the attachment - it is a screen shot of the error
    Attached Thumbnails Attached Thumbnails Capture.PNG  

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    This generally means that there are two Subs with the same name in the same Form. Search the code window for another Sub named Best_Of_Breed_Click.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    Aug 2007
    Posts
    38
    Thanks !!! I will have a look.

Posting Permissions

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