I need a message if number of duplicate records exceeds number allowed - 97019

Thanks in advance for any help.  I'm trying to create If DCount code on my
form that will count the number of duplicate records and then notify me when
the number of duplicate records exceeds the number allowed. The number of
duplicates allowed is established in tblFloorProgCriteria in the field
FloorProgMaxObservations. Here's what I have so far...It's giving me the
message as soon as I attempt to add the first record.

        If DCount("*", "tblFloorProgAudit", "[AuditID] = " & Me.[AuditID] & "
And [FloorProgCriteriaID] = " & _
        Me.[FloorProgCriteriaID] & " And [AuditorID] = '" & Me.[AuditorID] &
"'") > " & Me.[FloorProgMaxObservations] & " Then
           MsgBox "You're attempting to exeed the maximum number of
observation allowed for this criteria set. Click OK and then delete this
observation."
        Cancel = True
    End If

0
T5925MS
2/20/2010 1:35:14 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

2 Replies
683 Views

Similar Articles

[PageSpeed] 20

Which event are you using to run this code? It should be the form's 
BeforeUpdate event, most likely.

Also, on which part of your form is the [FloorProgMaxObservations] control 
located (form header? detail? form footer?)? or is that just a field in the 
form's recordsource query? Are you using Single Form or Continuous Forms 
view for your form?
-- 

        Ken Snell
http://www.accessmvp.com/KDSnell/




"T5925MS" <u58316@uwe> wrote in message news:a3eabbddd06d7@uwe...
> Thanks in advance for any help.  I'm trying to create If DCount code on my
> form that will count the number of duplicate records and then notify me 
> when
> the number of duplicate records exceeds the number allowed. The number of
> duplicates allowed is established in tblFloorProgCriteria in the field
> FloorProgMaxObservations. Here's what I have so far...It's giving me the
> message as soon as I attempt to add the first record.
>
>        If DCount("*", "tblFloorProgAudit", "[AuditID] = " & Me.[AuditID] & 
> "
> And [FloorProgCriteriaID] = " & _
>        Me.[FloorProgCriteriaID] & " And [AuditorID] = '" & Me.[AuditorID] 
> &
> "'") > " & Me.[FloorProgMaxObservations] & " Then
>           MsgBox "You're attempting to exeed the maximum number of
> observation allowed for this criteria set. Click OK and then delete this
> observation."
>        Cancel = True
>    End If
> 


0
Ken
2/20/2010 2:48:29 PM
I'm using the form's BeforeUpdate event to run the code. The
[FloorProgMaxObservations] control 
is just a field in the form's recordsource query. Should I have it in the
form somewhere? I'm using using Single Form view for the form.

Ken Snell wrote:
>Which event are you using to run this code? It should be the form's 
>BeforeUpdate event, most likely.
>
>Also, on which part of your form is the [FloorProgMaxObservations] control 
>located (form header? detail? form footer?)? or is that just a field in the 
>form's recordsource query? Are you using Single Form or Continuous Forms 
>view for your form?
>> Thanks in advance for any help.  I'm trying to create If DCount code on my
>> form that will count the number of duplicate records and then notify me 
>[quoted text clipped - 15 lines]
>>        Cancel = True
>>    End If

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201002/1

0
T5925MS
2/22/2010 10:55:28 PM
Reply:

Similar Artilces:

Not sure if Excel can do what i need
Hello all, I am obviously a new user to excel. I have a psychological assessmen that needs to be computerised for ease of use in obtaining results. Here is what i would like to happen. I have 28 questions with fiv Likert scale options(0-4) for answers. Each question addresses 1 of different personality traits. So questions 1, 6, 8, 22 look at anger. Where as questions 2, 9, 28 look at happiness. What i would like is fo excel to group the answers and give me the total number for each trait. Then based on that number, give out a prewritten (which i would provide result of the assessment. ...

how do i add my phone number to outlook address book ?
how do i add my phone number to outlook address book ? You can't. Why would you? The Outlook Address Book is only a list of electronic addresses to which you can address messages. Why would you need a phone number there? Phone numbers, like all Contact data, are stored in your Contacts Folder. -- Russ Valentine [MVP-Outlook] "Ingaga" <Ingaga @discussions.microsoft.com> wrote in message news:2C2224F0-0E8B-4E20-A2AC-200B044053FD@microsoft.com... > how do i add my phone number to outlook address book ? What in the world is the purpse of the Outlook address book whe...

Need Min Value from Row and Heading Value that Corresponds to it.
I have a table that looks somewhat like this w/o the *'d headings: h1 h2 h3 h4 h5 h6 h7 *Min Price *Heading $5.00 $6.00 $3.00 $4.00 $9.00 $1.00 $9.00 $1.00 h6 $3.00 $6.00 $8.00 $65.00 $9.00 $2.00 $4.00 $2.00 h6 $4.00 $9.00 $5.00 $7.00 $1.00 $2.00 $8.00 $1.00 h5 $9.00 $7.00 $6.00 $3.00 $9.00 $8.00 $2.00 $2.00 h7 $7.00 $8.00 $9.00 $7.00 $9.00 $8.00 $8.00 $7.00 h1 I have several SKU's with various price contract/programs. I want to find the best price in one cell and the heading that would correspond to that cell in another. I was trying to do this with an expression ...

New message alert to mobile phone
Hi, is there any way to configure Exchange - possibly using OMA - to send a notification/alert to a user's mobile phone (via SMS) saying that a new e-mail has arrived for that person i.e. for security and privacy reasons we don't want any details of the e-mail sent just the fact that one has arrived??? Many thanks. ...

Excel need help
I have 2 columns a and b . a contains payment b contains balance. I have the entire col b with the formula. my ? is when the balance appearsin b it is in all the cells in that column.I only want it in the used ones, not the unused ones:( example $270.00 16,730.00 $270.00 16,460.00 $100.00 16,360.00 $300.00 16,060.00 $270.00 15,790.00 15,790.00 15,790.00 15,790.00 15,790.00 15,790.00 this 15790.00 is in col b...not a...I want no bal in unused cells -- fiftieslady ------------------------------------------------------------------------ fiftieslady's Profile: http://www.excelforum.co...

Budget Record for Dividends in Broker Account
I am trying to set up my budget to include dividends from one of my Investment accounts. =the account has the "include in Budget Planner" box checked =Dividends are recorded as "Investment Income : Dividends" using the Investment tab in Tools for Dividend Income The dividend transactions are not included in any of the Budget Planner categories for Income. There is a category listed as Irregular Income, with a category called, "Investment Income : Dividends" Is there a particular reason why these transactions aren't picked up? Possibly because they ...

Need Help Linking Sheets
How can I link 2 pages without using the actual sheet as a reference? In other words, can I have two sheets linked by Identifying the same exact names one on each sheet? ...

Excel newbie needs help from math wiz (poker related)
I want to create a Excel workbook that will help in specific poker situations. Short version: I want to be able to calculate how often my opponent will need to fold for an all-in raise to show a positive expectation. Explanation: In poker you can win a hand by having the best hand at the end OR getting your opponent to fold. A common situation comes up where you have a "drawing hand" and face a bet by your opponent. In this situation you know you are currently behind in the hand, but have a chance to win if you catch some of your "outs" (cards that will give you th...

Command Button to Uncheck Checkbox on all records
I create a command button to uncheck a checkbox on the form, which works, but I want it to uncheck the the same checkbox on all records. I am doing this for the church and am not using access on a regular basis, so I just need the rest of the code. Thanks for any help. -- Kate Just learning to use access Kate, You will need an Update Query. You can do this in code, which runs on the Click event of your command button, like this: CurrentDb.Execute "UPDATE YourTable SET YourYesNoField = 0", dbFailOnError -- Steve Schapel, Microsoft Access MVP Kate wrote: > I create a com...

Macro help needed........
How do I sort a particular column in ascending order and change the pag setup to landscape and margins to 0.25 using a macro code ? does anyone have a macro code for this ????? -- Message posted from http://www.ExcelForum.com Hi you have already received some answers in your previous threads please don't multipost! -- Regards Frank Kabel Frankfurt, Germany > How do I sort a particular column in ascending order and change the > page setup to landscape and margins to 0.25 using a macro code ? > > does anyone have a macro code for this ?????? > > > --- > Me...

Need to test a mobo
I had a power surge about 3 weeks ago - lost a drive, now making ticking noises. I had another two drive that seem to work sporadically now. So, I thought it might have been my power supply. Bought a tester and found out that all seems well. Next, I bought a new hard drive and found that it was also acting up - making noises like whirring up and down (like the other drives I thought were dead). So I am starting to wonder if it is my mobo - but how can I test this out? I am using a dual boot - Win XP and Win 7 - both drives work and don't work. Up and down. Right now my Win7 ...

Get complete email message source from Outlook 2003???
Hello! I need to be able to simply copy/paste the COMPLETE source data from an email message recieved in Outlook 2003. I know I can get headers by using Options, but I need the complete message. In Outlook Express this is very easy. Select the message, view Properties, Details, Message Source button... Voila! I don't see how Microsoft could omit this in Outlook 2003! http://www.outlook-tips.net/howto/view_source.htm -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Outlook Tips: http://www...

Great Plains Companies should allow window color settings
It would be helpful if Great Plains would allow different window color schemes for each Company. This would be especially beneficial to identify when you are in a Test company. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions...

Help needed
is there anyway you can see what links to other workbooks are associated with the workbook you have open. The problem i am having is when i open the workbook in question a message appears and states "The workbook you opened contains automatic links to information in another workbook. do you want to update this workbook with changes made to the other workbook" Yes....... No. if i click No the workbook opens, however if i click Yes the workbook just hangs and i have to go into task manager to shut down the system. I can only assume that there is a problem with one of the links....

Messages NOT deleted from the POP3 mailserver
Anybody knows the answer to this question? >I use Outlook 2002 with a POP3 server. I choose the >option "Leave on the server" with the additional >option "Remove when deleted from Deleted items". This >doesn't work and none of the messages I receive are >deleted from the server and all remain there. When I use >other email tools, I don't have this problem. I have also installed service pack 3 and it still continues to have this problem. ...

Need help on this....thanks
I have an Excel worksheet which stored a survey outcome of over 1200 members. There are over 30 questions in the survey and the first column captured the member ID. The problem is 3 of the survey questions that allow multiple answers, instead the answer for those three questions are captured in seperate column, the answers are stored in a single column and it makes it very difficult to analysis those result. As a result I created addittional columns depending on the total number of the answers available for that question and assign the result manually to that column. It is very time consuming ...

Removing attactments from sents messages
Hi O'2000 sr1 Is there a way to remove the attainments from all my sent messages in one go? TIA Dave F. ye ----- Dave F wrote: ---- H O'2000 sr Is there a way to remove the attainments from all my sent messages in on go TI Dave F. ...

How do I see my own message posts ?
Hi On many forums (inc some Microsoft), once you have signed in with MS Live ID you can see your own posts very easily...can't see a way to do that on MS Office Online Forums. ?! Any way to do this (to save searching...I seem to keep 'losing' posts....unless MS are removing them ?) Thanks tomhass Generally not wise to use the MS Discussion Group web interface. Better to use an alternative method of accessing the newsgroups (then you might stand a better chance of seeing replies from the wider world, which the MSDG interface has been ignoring in recent wee...

I need Help
I have a random popup that i cant stop,when it does come up it seems to know what i was looking at,like when i was looking for registry cleaner it popped up and showed me one,any help would be great. On Jan 22, 6:57=A0am, Larry <La...@discussions.microsoft.com> wrote: > I have a random popup that i cant stop,when it does come up it seems to k= now > what i was looking at,like when i was looking for registry cleaner it pop= ped > up and showed me one,any help would be great. To eliminate questions and guessing, please provide additional information about your sys...

need help badly
How do you print ole objects.. Thanks lachanda -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200710/1 On Wed, 03 Oct 2007 18:13:40 GMT, "misschanda via AccessMonster.com" <u36612@uwe> wrote: >How do you print ole objects.. >Thanks >lachanda What *kind* of OLE objects? Many of them are binary blobs (such as programs) which are inherently not printable. More details please! John W. Vinson [MVP] ...

Stuck in review and need to be in design.
I am using Visio 2007. I need to complete the diagram that I have been working on and I hit the review key by mistake. How do I get back to the design screen? On Wed, 4 Nov 2009 16:14:01 -0800, cameron <cameron@discussions.microsoft.com> wrote: >I am using Visio 2007. I need to complete the diagram that I have been >working on and I hit the review key by mistake. How do I get back to the >design screen? menu Tools -> Track Markup and then close the Review window. -- Regards, Paul Herber, Sandrila Ltd. DFD/SSADM for Visio http://www.visio-dfd.sa...

Returned Mail for messages not sent
I'm getting lots of spam, and some of these seem to be sending acknowledgements to the originator. I get about 20 daily "Mail Returned" messages from the Mail Delivery Subsystem (about 10% of the spam volume), where the e-mail mailbox is closed. I'm downloading message headers and deleting the obvious spam, yet these apparently outgoing messages persist. Any ideas? Thanks. It is someone who has swen who also has your address. Just filter on common words such as virus, inet, ms, corporation, etc. --� Milly Staples [MVP - Outlook] Post all replies to the group to ke...

Need Help Despertly!
I am in a desperate situation. I had to reformat my hard drive. Prior to do this, I copied my entire User Profile to another drive. I can now access my User Profile information from Windows Explorer. Now that I installed Microsoft Outlook, I do not see any of my Contacts. I need to restore my Contacts to the new Outlook installation. Again, I did save my entire "User Profile" from my previous installation of Windows 2000 Professional. I just do not know how to access my Contact information from Outlook that included addresses and phone numbers and such. Any help would be greatly appr...

Plug in needed
Looking for an Outlook plug in which, on reply to a e-mail, will:- a) allow selective quoting only, and b) not top quote. Anything around at all? Much to my horror (sorry guys) the Boss wants us to use Outofluck at work! -- On the carpool lane lane to Nirvana. John Phillips <flatulentdingo@deadspam.com> wrote: > Looking for an Outlook plug in which, on reply to a e-mail, will:- > > a) allow selective quoting only, and > > b) not top quote. > > Anything around at all? The best Outlook adjunct I've found for quote handling on replies is Outlook-Quotef...

What is the Need for XSD in Application Blocks designing
Can anyone help in clearing my doubt Hi, There is a need for me to implement Application Blocks in my project, (Basically 3 tire), the project comprises of UIL, BLL,Business Entities, DAL.. When i saw the example programs from User Interface Application Block example, which is implementing the Business Layer part, Interface for BLL and Business Entity part where by i am not able to understand the real usage of XSD's and the autogenerated C#? Can anyone explain me what is the process flow behind this fuda in a simple terms. Thanks in Advance Jagadeesh ...