Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    37

    Unanswered: Checking for duplicate entries

    I am not having a good day today as everybody can probably tell by my frequent visits to this forum.

    I am trying to add new records to a table by using a form. i need to however check whether the record already exists before transfer the data. This should be really simple but I cannot work it out. this is what i have at the moment:

    Private Sub tbn_Add_Click()
    Dim err As Integer

    TxtName.SetFocus
    If TxtName.Text = "" Then
    MsgBox "Please enter a strategy name!"
    err = err + 1
    End If

    combo_Owner.SetFocus
    If combo_Owner = "" Then
    MsgBox "Please choose an owner for the strategy!"
    err = err + 1
    End If

    Combo_Type.SetFocus
    If Combo_Type = "" Then
    MsgBox "Please choose a strategy type!"
    err = err + 1
    End If

    TxtName.SetFocus
    Dim strate As String
    strate = TxtName.Text

    If strate = [(SE)_tbl_List_Strategies].[Strategy] Then
    MsgBox "This strategy already exists!"
    err = err + 1
    End If


    If err < 1 Then......


    the strate = [(SE)_tbl_List_Strategies].[Strategy] statement does not work. How do I do this!!?!?!?!?!

    End Sub

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    What does (SE)_tbl_List_Strategies] represents?

    Have a nice day!

  3. #3
    Join Date
    Mar 2009
    Posts
    37
    that is the name of the table I want the data to update to

Posting Permissions

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