Results 1 to 2 of 2
  1. #1
    accesslover is offline Novice
    Windows 11 Access 2021
    Join Date
    Jan 2023
    Posts
    9

    prevent adding records more than one time

    hello
    i have this sample database
    How i can make sure after pressing save BTN the code will start form the beginning each time I press save BTN
    to make sure the conditions will be applied

    1234.accdb

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Options:

    1. set sage and sname as compound unique index in table design and duplicate pairs will not be allowed

    2. code checks for existing record and prevents saving data if already exists

    If DCount("", "tblTest", "sname='" & Me.sname & "' AND sage=" & Me.sage) > 0 Then
    MsgBox "Record already exists."
    Else


    Normally, age is not saved, date of birth is saved and age is calculated.
    Last edited by June7; 02-09-2023 at 06:36 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 07-09-2019, 11:47 AM
  2. Replies: 4
    Last Post: 09-14-2018, 08:49 AM
  3. Replies: 1
    Last Post: 12-09-2016, 08:58 AM
  4. Adding multiple records at a time
    By shod90 in forum Forms
    Replies: 3
    Last Post: 08-14-2016, 12:11 PM
  5. Replies: 5
    Last Post: 04-11-2015, 03:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums