Results 1 to 4 of 4
  1. #1
    alfonsojansen is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    2

    validation to revent duplicate value

    Can somebody help me out, I complete new in this;

    I have created a form in access 2003 that monitors Member numbers that with an authorization. The authorization is for a certain period
    So I’m working with a:
    Member IDnumber
    Start date
    End date and a
    Registration date


    I am attempting to stop duplicate entries of Member IDnumbers being entered onto the form without ending the previous authorization when the end date Is Null

    In this case I want the system to fill the end date which has to be equal to the registration date of new record. ( =Date() )
    It has to be also possible to enter a value different from de default value of the end date by typing it but this can not be < then the new registration date nor < then the start date

    The defaultValue controle on registration date is set on =Date()


    I want all this to happened before updating



    However, I have no idea how to do this, and I'm unsure as to whether or not this is the best way to tackle the problem. Please, someone show me the way step by step!
    Alfonso

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    have you tried isNull()?

    if isnull(endDate) then
    ' SQL for update query to set endDate = the desired date
    end if

  3. #3
    alfonsojansen is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    2

    validation to revent duplicate value

    I'm trying these code but I’m getting “Run-Time error 424 Object Required” I don't understand whi is wrong.

    Alfonso

    Option Compare Database

    Private Sub MemberID_BeforeUpdate(Cancel As Integer)
    Dim ID As Long
    'Check to see if this is a duplicate value before update
    ID = Nz(DLookup("Member_IDNumber", "Lastgever", " Member_IDNumber =" & Lastgever. Member_IDNumber), 0)
    If ID <> 0 Then
    'Run a query to findout if there is already an autorisation
    DoCmd.RunSQL ("select Member_IDNumber From lastgever where Member_IDNumber =" & "textboxvalue" And EndDate Is Null)
    Cancel = True
    Else: MsgBox "Er bestaat reeds een machtiging dat afgesloten dient te worden"
    End If
    End Sub

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Else: MsgBox .....
    should be

    Else
    MsgBox .....

    I don't know if thats the issue but try that.

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

Similar Threads

  1. password validation
    By RycherX in forum Forms
    Replies: 1
    Last Post: 02-20-2010, 03:55 PM
  2. Validation problems...
    By dbDamo in forum Forms
    Replies: 1
    Last Post: 05-15-2009, 12:43 PM
  3. Data Validation - Please help
    By larry S in forum Access
    Replies: 0
    Last Post: 11-16-2008, 10:24 PM
  4. Validation Rule
    By mistaken_myst in forum Database Design
    Replies: 2
    Last Post: 10-29-2007, 02:08 PM
  5. Validation on import
    By andy_42 in forum Import/Export Data
    Replies: 1
    Last Post: 10-23-2006, 03:52 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