Access 2016 Or 365 Field Duplicates

Discussion in 'Software' started by DavidGP, Oct 17, 2020.

  1. DavidGP

    DavidGP MajorGeeks Forum Administrator - Grand Pooh-Bah Staff Member

    Hey folks

    Rare I ask for help but as I can write basic Access databases I have run out of talent with a verification issue, basically I have been tasked (out of my job role mind) with creating a new database and more complex that the basic one I have now, only did as it helped me, so I thought until senior doctors see it an think too much.

    Issue is I need a rule to stop duplictes as I have a 1 - many database, so basically Patient info gets inputted once and clinic visits many.

    Tables:
    Patient
    Monitoring_visit

    Want in Patient and have a search option to check on if Patient code is in database, but want am extra layer of NOT CRASHING database, in if someone enters any already patient code that the database thows up a message in duplicate and doesnt update.

    Tried

    Private Sub txtRQnumber_BeforeUpdate(Cancel As Integer)
    On Error Resume Next

    If DCount("*", "Patient_Info", "RQnumber='" & Me.txtRQnumber.Value & "' and RQnumber='" & Me.txtRQnumber.Value & "'") > 0 Then
    MsgBox "The Patient RQ Number is already in database, please click the Monitoring Visit tab", vbInformation, "Duplicate RQ Number"
    Me.txtRQnumber.SetFocus
    Cancel = True

    End If
    End Sub​

    RQ number is like RQ1000000 and unique to a person, is .value right?
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds