PC Review


Reply
Thread Tools Rate Thread

How do I prevent an append query from running twice with the same

 
 
=?Utf-8?B?Q0Y=?=
Guest
Posts: n/a
 
      13th Feb 2006
I am writing a database to keep a record of the labour involved in a seed
treating plant.
Every day the register is taken - yes/no in present colum and the date
inserted as per the date on an unbound form.
The date form has a button which, when clicked, runs an append query and the
data appended to the register table.

My question is:
How do I prevent the data entry clerk from running the append query twice?

I have a count query to count the number of names in the register for that
particular date.
If the count = 0 then no append has been run
I cannot get the If (CountOfNames = 0) then run the qppend query to work.

Can anyone help?


 
Reply With Quote
 
 
 
 
Jeff Boyce
Guest
Posts: n/a
 
      13th Feb 2006
The generic approach is:

* Use code, preferably run from the click of a command button on a form
* In your code, use the number of records with today's date to decide
whether to run
* You need to look up using recordsets and the .BOF & .EOF (begin/end of
file) property to decide

Or, you could set a uniqe index on the table that rejects duplicates (you
decide what constitutes a duplicate in terms of which fields).

--
Regards

Jeff Boyce
Microsoft Office/Access MVP
Microsoft IT Academy Program Mentor

"CF" <(E-Mail Removed)> wrote in message
news:EC7ED0D6-994D-41B6-89EC-(E-Mail Removed)...
> I am writing a database to keep a record of the labour involved in a seed
> treating plant.
> Every day the register is taken - yes/no in present colum and the date
> inserted as per the date on an unbound form.
> The date form has a button which, when clicked, runs an append query and

the
> data appended to the register table.
>
> My question is:
> How do I prevent the data entry clerk from running the append query twice?
>
> I have a count query to count the number of names in the register for that
> particular date.
> If the count = 0 then no append has been run
> I cannot get the If (CountOfNames = 0) then run the qppend query to work.
>
> Can anyone help?
>
>


 
Reply With Quote
 
Jeff Boyce
Guest
Posts: n/a
 
      13th Feb 2006
that should have been "unique"

Jeff

"CF" <(E-Mail Removed)> wrote in message
news:EC7ED0D6-994D-41B6-89EC-(E-Mail Removed)...
> I am writing a database to keep a record of the labour involved in a seed
> treating plant.
> Every day the register is taken - yes/no in present colum and the date
> inserted as per the date on an unbound form.
> The date form has a button which, when clicked, runs an append query and

the
> data appended to the register table.
>
> My question is:
> How do I prevent the data entry clerk from running the append query twice?
>
> I have a count query to count the number of names in the register for that
> particular date.
> If the count = 0 then no append has been run
> I cannot get the If (CountOfNames = 0) then run the qppend query to work.
>
> Can anyone help?
>
>


 
Reply With Quote
 
=?Utf-8?B?SmVycnkgV2hpdHRsZQ==?=
Guest
Posts: n/a
 
      13th Feb 2006
If the business rule is that the records are appended to the table only once
a day, make the date field a unique constraint at the table level. As long as
you are using Date() and not Now() to populate the record, that should stop
it. Just be ready to trap that error at the form.

Another method would be to do a DMax of the date field in the table when you
push the button on the form. If there is a matching date, don't run the
append query.

--
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"CF" wrote:

> I am writing a database to keep a record of the labour involved in a seed
> treating plant.
> Every day the register is taken - yes/no in present colum and the date
> inserted as per the date on an unbound form.
> The date form has a button which, when clicked, runs an append query and the
> data appended to the register table.
>
> My question is:
> How do I prevent the data entry clerk from running the append query twice?
>
> I have a count query to count the number of names in the register for that
> particular date.
> If the count = 0 then no append has been run
> I cannot get the If (CountOfNames = 0) then run the qppend query to work.
>
> Can anyone help?
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
prevent redundacy in append query Amod Microsoft Access Queries 8 17th Feb 2009 05:50 PM
prevent redundancy of records in append query Amod Microsoft Access 6 23rd Jul 2008 01:58 PM
Prevent Duplication when ruunning Append query Jahanzaib Microsoft Access Queries 2 7th Apr 2008 04:39 PM
Prevent Duplicates using an Append Query pete.trudell@twc.state.tx.us Microsoft Access Queries 3 19th Sep 2006 06:44 PM
Append Query, Prevent Duplicates? Randy Microsoft Access Queries 3 29th Jun 2005 12:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:26 PM.