A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Avoiding duplication in a table.



 
 
Thread Tools Display Modes
  #1  
Old September 25th, 2009, 02:30 AM posted to microsoft.public.access.tablesdbdesign
Frank Martin
external usenet poster
 
Posts: 162
Default Avoiding duplication in a table.

I have an append query "QryInvoiceGrouped" and I have set
its "top value" property to 1.

Therefore when I run this query it will append this 'top
value' into the destination table "LedgerTxns".

This works OK, but I need some setting in the table design
grid to ensure this procedure cannot be doubled up by
inadvertently running the append query twice.

A relevant unique field in the appended data is "OrderNo"
and I need some function to insert into the "OrderNo" field
property "ValidationRule" to ensure no duplicates are
possible.

Please help, Frank




  #2  
Old September 25th, 2009, 03:06 AM posted to microsoft.public.access.tablesdbdesign
Klatuu
external usenet poster
 
Posts: 7,074
Default Avoiding duplication in a table.

The OrderNo field should by the primary key of the table. You cannot insert
a record with a duplicate value in the field that way. If you try, it will
throw an error.

I would then execute the query using the Execute method of the database
object with the dbFailOnError option which will pass the Jet error back.
Then capture the error you procedure's error handler.
--
Dave Hargis, Microsoft Access MVP


"Frank Martin" wrote:

I have an append query "QryInvoiceGrouped" and I have set
its "top value" property to 1.

Therefore when I run this query it will append this 'top
value' into the destination table "LedgerTxns".

This works OK, but I need some setting in the table design
grid to ensure this procedure cannot be doubled up by
inadvertently running the append query twice.

A relevant unique field in the appended data is "OrderNo"
and I need some function to insert into the "OrderNo" field
property "ValidationRule" to ensure no duplicates are
possible.

Please help, Frank





  #3  
Old September 25th, 2009, 04:03 AM posted to microsoft.public.access.tablesdbdesign
Frank Martin
external usenet poster
 
Posts: 162
Default Avoiding duplication in a table.

Thank you. The table already has a PrimaryKey.

I have set the properties of the "OrderNo" field to Indexed
No Duplicates, and this seems to be working.

Regards, Frank


"Klatuu" wrote in message
...
The OrderNo field should by the primary key of the table.
You cannot insert
a record with a duplicate value in the field that way. If
you try, it will
throw an error.

I would then execute the query using the Execute method of
the database
object with the dbFailOnError option which will pass the
Jet error back.
Then capture the error you procedure's error handler.
--
Dave Hargis, Microsoft Access MVP


"Frank Martin" wrote:

I have an append query "QryInvoiceGrouped" and I have
set
its "top value" property to 1.

Therefore when I run this query it will append this 'top
value' into the destination table "LedgerTxns".

This works OK, but I need some setting in the table
design
grid to ensure this procedure cannot be doubled up by
inadvertently running the append query twice.

A relevant unique field in the appended data is "OrderNo"
and I need some function to insert into the "OrderNo"
field
property "ValidationRule" to ensure no duplicates are
possible.

Please help, Frank







 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:11 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.