Re: Preventing Duplicate Records
- From: rjshrader@xxxxxxxxx
- Date: Thu, 17 Jan 2008 06:56:25 -0800 (PST)
On Jan 17, 9:38 am, "ruralguy via AccessMonster.com" <u12102@uwe>
wrote:
Please post your DCount() code so we can see it.
rjshra...@xxxxxxxxx wrote:
On Jan 16, 9:55 pm, "ruralguy via AccessMonster.com" <u12102@uwe>
wrote:
Have you tried using DCount() of DLookup() before saving?http://www.mvps.org/access/general/gen0018.htm
[quoted text clipped - 23 lines]
- Show quoted text -
I have played with both and understand how to use DCount to retrieve
the number of occurrences of a record and with DLookup to retrieve a
value. I added a MSGBOX (variable) to display the results so I could
see what was being retrieved or counted....but I do not understand how
to use them to check for the duplicate.
--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2008...
ScanCount = DCount("StatusDate", "tblStatus", "CustomerID = '" &
Me.txtCustomerID.Value & "'")
Msgbox (ScanCount)
I then have this code that runs before saving the record to the table
If ScanCount > 0 then
msg = "Customer ID can only be scanned once per day; this ID number
has already been scanned today."
Style = vbInformation
Title = "Failed Scan Attempt"
Response = MsgBox(msg, Style, Title)
Me.txtCustomerID.SetFocus
Exit Sub
End If
What I find is that I will scan the customers id number yesterday and
then when I go to scan it again today I get the error message that I
have generated. After thinking about it it makes sense that I have
scaned it and if it is > than 0 (which it is) return th error message.
I'm just not getting how to check for a certain date I guess as
apposed to a count of the total number of dates.
.
- Follow-Ups:
- Re: Preventing Duplicate Records
- From: ruralguy via AccessMonster.com
- Re: Preventing Duplicate Records
- References:
- Preventing Duplicate Records
- From: rjshrader
- Re: Preventing Duplicate Records
- From: ruralguy via AccessMonster.com
- Re: Preventing Duplicate Records
- From: rjshrader
- Re: Preventing Duplicate Records
- From: ruralguy via AccessMonster.com
- Preventing Duplicate Records
- Prev by Date: Re: Preventing Duplicate Records
- Next by Date: Re: Access Future?
- Previous by thread: Re: Preventing Duplicate Records
- Next by thread: Re: Preventing Duplicate Records
- Index(es):
Relevant Pages
|