conditional appending through append query

A

Azad, DH, BD

Validate the existing date in append query. I have a inventory table where
the whole month inventory data will be appended by an append query only once
in a month on the last date. If the records already exist by last date (i.e
all the records have last date field as bellow given table) , it will show me
a msg that the records have already been added & will not repetitively add
the data i.e will cancel the action. I have a command button that will run
the append query and if the last date matches, append query will cancel
appending the data to the inventory table. How can I do this?



Inventory table

Item Qty unit Consumption Last Date
Grey cement 500 Bag 230 6/30/2008
Local sand 1052 Cft 550 5/31/2008
Grey cement 562 Bag 256 5/31/2008
Local sand 1026 Cft 450 6/30/2008
Bricks 55630 Nos 6300 5/31/2008
Bricks 55230 Nos 6100 6/30/2008


Now it the records set bellow are attempted to append to the table , they
should be rejected because the last date 6/30/2008 are existing.

Item Qty unit Consumption Last Date
Grey cement 500 Bag 230 6/30/2008
Local sand 1026 Cft 450 6/30/2008
Bricks 55230 Nos 6100 6/30/2008
 
S

strive4peace

Hi Azad,

in your Inventory table, define a UNIQUE index on the combination of:
Item
Last Date

then, if you attempt to add a record with those same field values, they
simply won't go in :)

This document explains more about multi-field unique indexes:

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace


Warm Regards,
Crystal

remote programming and training


*
:) have an awesome day :)
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top