Results 1 to 3 of 3
  1. #1
    Ghazwan is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2018
    Posts
    1

    update a record

    Hi,
    I dont have a lot of experience in access actually so I have a registration form that info will be send to a table but I dont want to have a duplicate records in my table so I want to have a button that update and save if the records already exist if someone can help will be appreciate it .



    Thanks in advanced

  2. #2
    fletcjas is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2018
    Location
    Lincoln, UK
    Posts
    23
    I have a registration form (pictured)
    Code:
    Private Sub UserName_AfterUpdate()
    
    If DLookup("FIELD", "TABLE", "FIELD = '" & TEXTBOX & "'") > 0 Then
    Beep
        MsgBox "Username has already been used, Please choose another.", vbInformation, "Duplicate User"
        Me.UserName.SetFocus
        Me.UserName.SetFocus
        End If
    
    
    End Sub
    Click image for larger version. 

Name:	gg.PNG 
Views:	6 
Size:	6.8 KB 
ID:	36410

    I use the code above, Just enter your info where there are capitals. If you have a database, you can upload and will put the code in place.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    If it's a situation where you either create a new record or update the existing one, I'd either code something into a single form or open a second form. Opening the second could look like this:

    http://www.baldyweb.com/Bookmark.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 11-19-2018, 07:57 PM
  2. Replies: 3
    Last Post: 10-04-2015, 10:17 AM
  3. Update Table after Record Update with Form
    By speciman_A in forum Forms
    Replies: 25
    Last Post: 10-31-2014, 01:00 PM
  4. Replies: 14
    Last Post: 08-12-2014, 06:33 AM
  5. Replies: 4
    Last Post: 12-14-2012, 06:33 PM

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