[AccessD] Duplicates on Two Values

William Hindman wdhindman at dejpolsystems.com
Wed Nov 18 12:33:00 CST 2009


...I must be missing something again ...happens more and more often these 
days

...but why not just set a unique index on the table using the two fields and 
trap for the error?
...use the error trap to pop up a custom dialog

William

--------------------------------------------------
From: "Hollis, Virginia" <hollisvj at pgdp.usec.com>
Sent: Wednesday, November 18, 2009 12:50 PM
To: <accessd at databaseadvisors.com>
Subject: [AccessD]  Duplicates on Two Values

> This gives me an error. I think because I have the text fields ''''
> messed up.
>
>
>
>  If Not IsNull(ItemName) And Not IsNull(ItemDesc) Then
>
>    If DCount("ItemName", "tbl_ItemMain", "ItemName = '" & [ItemName] &
> "'and "ItemDesc = '" & [ItemDesc]) > 0 Then
>
>        MsgBox "You have entered a ItemName and ItemDesc that already
> exists"
>
>        ItemName.SetFocus
>
>        ItemName.Undo
>
>    End If
>
> End If
>
>
>
>
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list