Results 1 to 1 of 1

Thread: Help with form

  1. #1
    Join Date
    Jun 2009
    Posts
    1

    Unanswered: Help with form

    Hi,

    I use a form to see if a tel. number is in the database. The user puts in the number in a combobox. If the number is in the database, the record is shown. If the number is unknown, the following vba script must add the record to the database. Till so far it's working.

    Now when a number is unknown in the DB and I say that i want to add the number, the script ask me again if i want to add the number. and again and again. This results in multiple equal numbers in the database.

    Also i want the script (when i type a new number) to ask me to fill in the Name(naam), Surname(achternaam), adress(adres), livingplace(woonplaats) and put this in de Klanten table.

    My VBA knowledge is to small to fix this.
    I hope that someone can help me with this.

    Patrick

    Private Sub Keuzelijst_met_invoervak15_NotInList(NewData As String, Response As Integer)

    On Error GoTo cboJobTitle_NotInList_Err
    Dim intAnswer As Integer
    Dim strSQL As String
    Dim Naam As Integer
    Dim Achternaam As Integer
    Dim Adres As Integer
    Dim Woonplaats As Integer



    intAnswer = MsgBox("The phonenumber " & Chr(34) & NewData & _
    Chr(34) & " is unknown." & vbCrLf & _
    "Dow you want to add??" _
    , vbQuestion + vbYesNo, "TEZO")
    If intAnswer = vbYes Then
    strSQL = "INSERT INTO klanten([telefoonnummer]) " & _
    "VALUES ('" & NewData & "');"
    DoCmd.SetWarnings False
    DoCmd****nSQL strSQL
    DoCmd.SetWarnings True
    MsgBox "The phonenumber is added." _
    & "Fill in the other fields" _
    , vbInformation, "TEZO"

    Response = acDataErrContinue


    Else
    MsgBox "Select the right number." _
    , vbInformation, "TEZO"
    Response = acDataErrContinue
    End If
    cboJobTitle_NotInList_Exit:
    Exit Sub
    cboJobTitle_NotInList_Err:
    MsgBox Err.Description, vbCritical, "Error"
    Resume cboJobTitle_NotInList_Exit

    End Sub


    Can be closed
    Last edited by pafs; 06-18-09 at 04:34. Reason: Solved

Posting Permissions

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