Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Duplicate entries

Discussion in 'Information Technology' started by tanhus, Jul 28, 2006.

  1. tanhus

    tanhus
    Expand Collapse
    Guest

    How do you check to see if there is already a duplicate entry with vba code?
    Lets just say theres a table called Name with:
    Field Name Data Type
    First Name Text
    Last Name Text
    You enter in Micheal into FirstNameTextBox and Moore into LastNameTextBox
    but this entry already entered into our table because the vba code has
    checked the Name table out and gives a message box stating that.
     
  2. Loading...

    Similar Threads Forum Date
    Sikh News Duplicate passports offered by GOI to Indians residing in Italy Breaking News Sep 19, 2009
    Sikh News Case of the duplicate signatures (San Jose Mercury News) Breaking News Apr 4, 2005
    Sikh News Entries from Torontoist tagged with 'sikhism' (Torontoist) Breaking News Apr 24, 2008
    Sikh News 61 entries for Realtech Punjab Open Ladies Golf (Deepika) Breaking News Oct 23, 2007
    Sikh News 61 entries for Realtech Punjab Open Ladies Golf (Deepika) Breaking News Oct 22, 2007

  3. schasteen

    schasteen
    Expand Collapse
    Guest

    You can use a dlookup in the before update of the form

    if not isnull(dlookup("PK","YourTable","[First Name] ='"& Me![FirstName] &
    "' and [LastName] = '" & Me![LastName] & "'")) then
    msgbox("Already exisits")
    end if


    "tanhus" wrote:

    > How do you check to see if there is already a duplicate entry with vba code?
    > Lets just say theres a table called Name with:
    > Field Name Data Type
    > First Name Text
    > Last Name Text
    > You enter in Micheal into FirstNameTextBox and Moore into LastNameTextBox
    > but this entry already entered into our table because the vba code has
    > checked the Name table out and gives a message box stating that.
     
  4. tanhus

    tanhus
    Expand Collapse
    Guest

    Im getting an error that says

    Run-time error '2001':
    You cancelled the previous operation.


    "schasteen" wrote:

    > You can use a dlookup in the before update of the form
    >
    > if not isnull(dlookup("PK","YourTable","[First Name] ='"& Me![FirstName] &
    > "' and [LastName] = '" & Me![LastName] & "'")) then
    > msgbox("Already exisits")
    > end if
    >
    >
    > "tanhus" wrote:
    >
    > > How do you check to see if there is already a duplicate entry with vba code?
    > > Lets just say theres a table called Name with:
    > > Field Name Data Type
    > > First Name Text
    > > Last Name Text
    > > You enter in Micheal into FirstNameTextBox and Moore into LastNameTextBox
    > > but this entry already entered into our table because the vba code has
    > > checked the Name table out and gives a message box stating that.
     
  5. schasteen

    schasteen
    Expand Collapse
    Guest

    Can you please post the code you have.

    "tanhus" wrote:

    > Im getting an error that says
    >
    > Run-time error '2001':
    > You cancelled the previous operation.
    >
    >
    > "schasteen" wrote:
    >
    > > You can use a dlookup in the before update of the form
    > >
    > > if not isnull(dlookup("PK","YourTable","[First Name] ='"& Me![FirstName] &
    > > "' and [LastName] = '" & Me![LastName] & "'")) then
    > > msgbox("Already exisits")
    > > end if
    > >
    > >
    > > "tanhus" wrote:
    > >
    > > > How do you check to see if there is already a duplicate entry with vba code?
    > > > Lets just say theres a table called Name with:
    > > > Field Name Data Type
    > > > First Name Text
    > > > Last Name Text
    > > > You enter in Micheal into FirstNameTextBox and Moore into LastNameTextBox
    > > > but this entry already entered into our table because the vba code has
    > > > checked the Name table out and gives a message box stating that.
     
  6. tanhus

    tanhus
    Expand Collapse
    Guest

    If Not IsNull(DLookup("PK", "TimeCardApproval", "[Team Member ID] ='" &
    TeamMemberCombo.Value & "' and [Week Ending] = '" & DateText.Value & "'"))
    Then
    MsgBox ("Already exisits")
    End If

    TimeCardApproval is the table
    Team Member ID is the field name in the table
    TeamMemberCombo.Value is the textbox in the form in which im checking to see
    if its in the table
    Week Ending is the field name in the table
    DateText.Value us the textbox in the form in which im checkign to see if its
    in the table

    "schasteen" wrote:

    > Can you please post the code you have.
    >
    > "tanhus" wrote:
    >
    > > Im getting an error that says
    > >
    > > Run-time error '2001':
    > > You cancelled the previous operation.
    > >
    > >
    > > "schasteen" wrote:
    > >
    > > > You can use a dlookup in the before update of the form
    > > >
    > > > if not isnull(dlookup("PK","YourTable","[First Name] ='"& Me![FirstName] &
    > > > "' and [LastName] = '" & Me![LastName] & "'")) then
    > > > msgbox("Already exisits")
    > > > end if
    > > >
    > > >
    > > > "tanhus" wrote:
    > > >
    > > > > How do you check to see if there is already a duplicate entry with vba code?
    > > > > Lets just say theres a table called Name with:
    > > > > Field Name Data Type
    > > > > First Name Text
    > > > > Last Name Text
    > > > > You enter in Micheal into FirstNameTextBox and Moore into LastNameTextBox
    > > > > but this entry already entered into our table because the vba code has
    > > > > checked the Name table out and gives a message box stating that.
     
  7. schasteen

    schasteen
    Expand Collapse
    Guest

    You need to change the PK with a field from your table, perferably the
    primary key of the table. If TeamMemberID is a number you need to remove the
    ' before and after. If DateText is a date you may need to add # before and
    after

    If Not IsNull(DLookup("PK", "TimeCardApproval", "[Team Member ID] =" &
    Me.TeamMemberCombo.Value & " and [Week Ending] = #" & Me.DateText.Value &
    "#"))

    "tanhus" wrote:

    > If Not IsNull(DLookup("PK", "TimeCardApproval", "[Team Member ID] ='" &
    > TeamMemberCombo.Value & "' and [Week Ending] = '" & DateText.Value & "'"))
    > Then
    > MsgBox ("Already exisits")
    > End If
    >
    > TimeCardApproval is the table
    > Team Member ID is the field name in the table
    > TeamMemberCombo.Value is the textbox in the form in which im checking to see
    > if its in the table
    > Week Ending is the field name in the table
    > DateText.Value us the textbox in the form in which im checkign to see if its
    > in the table
    >
    > "schasteen" wrote:
    >
    > > Can you please post the code you have.
    > >
    > > "tanhus" wrote:
    > >
    > > > Im getting an error that says
    > > >
    > > > Run-time error '2001':
    > > > You cancelled the previous operation.
    > > >
    > > >
    > > > "schasteen" wrote:
    > > >
    > > > > You can use a dlookup in the before update of the form
    > > > >
    > > > > if not isnull(dlookup("PK","YourTable","[First Name] ='"& Me![FirstName] &
    > > > > "' and [LastName] = '" & Me![LastName] & "'")) then
    > > > > msgbox("Already exisits")
    > > > > end if
    > > > >
    > > > >
    > > > > "tanhus" wrote:
    > > > >
    > > > > > How do you check to see if there is already a duplicate entry with vba code?
    > > > > > Lets just say theres a table called Name with:
    > > > > > Field Name Data Type
    > > > > > First Name Text
    > > > > > Last Name Text
    > > > > > You enter in Micheal into FirstNameTextBox and Moore into LastNameTextBox
    > > > > > but this entry already entered into our table because the vba code has
    > > > > > checked the Name table out and gives a message box stating that.
     
  8. tanhus

    tanhus
    Expand Collapse
    Guest

    thanks that helped

    "schasteen" wrote:

    > You need to change the PK with a field from your table, perferably the
    > primary key of the table. If TeamMemberID is a number you need to remove the
    > ' before and after. If DateText is a date you may need to add # before and
    > after
    >
    > If Not IsNull(DLookup("PK", "TimeCardApproval", "[Team Member ID] =" &
    > Me.TeamMemberCombo.Value & " and [Week Ending] = #" & Me.DateText.Value &
    > "#"))
    >
    > "tanhus" wrote:
    >
    > > If Not IsNull(DLookup("PK", "TimeCardApproval", "[Team Member ID] ='" &
    > > TeamMemberCombo.Value & "' and [Week Ending] = '" & DateText.Value & "'"))
    > > Then
    > > MsgBox ("Already exisits")
    > > End If
    > >
    > > TimeCardApproval is the table
    > > Team Member ID is the field name in the table
    > > TeamMemberCombo.Value is the textbox in the form in which im checking to see
    > > if its in the table
    > > Week Ending is the field name in the table
    > > DateText.Value us the textbox in the form in which im checkign to see if its
    > > in the table
    > >
    > > "schasteen" wrote:
    > >
    > > > Can you please post the code you have.
    > > >
    > > > "tanhus" wrote:
    > > >
    > > > > Im getting an error that says
    > > > >
    > > > > Run-time error '2001':
    > > > > You cancelled the previous operation.
    > > > >
    > > > >
    > > > > "schasteen" wrote:
    > > > >
    > > > > > You can use a dlookup in the before update of the form
    > > > > >
    > > > > > if not isnull(dlookup("PK","YourTable","[First Name] ='"& Me![FirstName] &
    > > > > > "' and [LastName] = '" & Me![LastName] & "'")) then
    > > > > > msgbox("Already exisits")
    > > > > > end if
    > > > > >
    > > > > >
    > > > > > "tanhus" wrote:
    > > > > >
    > > > > > > How do you check to see if there is already a duplicate entry with vba code?
    > > > > > > Lets just say theres a table called Name with:
    > > > > > > Field Name Data Type
    > > > > > > First Name Text
    > > > > > > Last Name Text
    > > > > > > You enter in Micheal into FirstNameTextBox and Moore into LastNameTextBox
    > > > > > > but this entry already entered into our table because the vba code has
    > > > > > > checked the Name table out and gives a message box stating that.
     
  9. schasteen

    schasteen
    Expand Collapse
    Guest

    No problem

    "tanhus" wrote:

    > thanks that helped
    >
    > "schasteen" wrote:
    >
    > > You need to change the PK with a field from your table, perferably the
    > > primary key of the table. If TeamMemberID is a number you need to remove the
    > > ' before and after. If DateText is a date you may need to add # before and
    > > after
    > >
    > > If Not IsNull(DLookup("PK", "TimeCardApproval", "[Team Member ID] =" &
    > > Me.TeamMemberCombo.Value & " and [Week Ending] = #" & Me.DateText.Value &
    > > "#"))
    > >
    > > "tanhus" wrote:
    > >
    > > > If Not IsNull(DLookup("PK", "TimeCardApproval", "[Team Member ID] ='" &
    > > > TeamMemberCombo.Value & "' and [Week Ending] = '" & DateText.Value & "'"))
    > > > Then
    > > > MsgBox ("Already exisits")
    > > > End If
    > > >
    > > > TimeCardApproval is the table
    > > > Team Member ID is the field name in the table
    > > > TeamMemberCombo.Value is the textbox in the form in which im checking to see
    > > > if its in the table
    > > > Week Ending is the field name in the table
    > > > DateText.Value us the textbox in the form in which im checkign to see if its
    > > > in the table
    > > >
    > > > "schasteen" wrote:
    > > >
    > > > > Can you please post the code you have.
    > > > >
    > > > > "tanhus" wrote:
    > > > >
    > > > > > Im getting an error that says
    > > > > >
    > > > > > Run-time error '2001':
    > > > > > You cancelled the previous operation.
    > > > > >
    > > > > >
    > > > > > "schasteen" wrote:
    > > > > >
    > > > > > > You can use a dlookup in the before update of the form
    > > > > > >
    > > > > > > if not isnull(dlookup("PK","YourTable","[First Name] ='"& Me![FirstName] &
    > > > > > > "' and [LastName] = '" & Me![LastName] & "'")) then
    > > > > > > msgbox("Already exisits")
    > > > > > > end if
    > > > > > >
    > > > > > >
    > > > > > > "tanhus" wrote:
    > > > > > >
    > > > > > > > How do you check to see if there is already a duplicate entry with vba code?
    > > > > > > > Lets just say theres a table called Name with:
    > > > > > > > Field Name Data Type
    > > > > > > > First Name Text
    > > > > > > > Last Name Text
    > > > > > > > You enter in Micheal into FirstNameTextBox and Moore into LastNameTextBox
    > > > > > > > but this entry already entered into our table because the vba code has
    > > > > > > > checked the Name table out and gives a message box stating that.
     

Share This Page