470,593 Members | 2,471 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,593 developers. It's quick & easy.

Prevent Duplicate Entry within a Month

Hello

I have an access database for transactions
I want to prevent duplicate entry against any account
Suppose i have an account (4422A) and i want it to pay only one in a month
If i enter this account twice access don't allow this entry.


please help me
Thanks
Jan 21 '22 #1
2 10123
NeoPa
32,298 Expert Mod 16PB
Hi Usman.

Welcome to Bytes.com.

I have approved your question as valid, yet I must point out that it makes little sense and everyone will find it hard to understand what you want as you tell us so little.

You say you want to prevent any duplicate entries, then you go on to say they are already prevented as indicated by the reported error message.

You will need to explain your problem very much more clearly if you expect anyone to be able to help you. There's no doubt we'd like to if only your question made sense. Unfortunately ...
Jan 21 '22 #2
isladogs
352 Expert Mod 256MB
I'll try interpreting what I think you mean...

I want to prevent duplicate entry against any account
Suppose i have an account (4422A) and i want it to pay only one in a month
If i enter this account twice access don't allow this entry.


You can easily prevent duplicate entries by indexing the account field and specifying no duplicates
However, I think you mean that it would be OK to pay that account again the following month.

So, you could use a field called YearMonth or similar where this month would be 2201 & Feb 2022 would be 2202

Now you could validate entries using a DCount expression. Something like:

Expand|Select|Wrap|Line Numbers
  1. If DCount("Payment", "tblPayments", "AccountID = " & Me.AccountID And YearMonth = Format(Date,"yymm"))=0 Then
  2.   'allow payment
  3. End If
This undoubtedly needs modifying but it might get you started

EDIT Crossposted on at least two other forums
Jan 22 '22 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by mmazid | last post: by
1 post views Thread by Joseph Chase | last post: by
5 posts views Thread by baur79 | last post: by
6 posts views Thread by teser3 | last post: by
1 post views Thread by chicago1985 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.