comments inline.
"(PeteCresswell )" <x@y.Invalidwro te in message
news:ru******** *************** *********@4ax.c om...
Per tina:
create a set of
base queries, one for each *data* table, with the Deleted flag set to Is
Null or False or whatever is appropriate. use those queries as the base
for
all other queries.
I think you guys are winning me over.
The base query idea was the tipping point. I could use a
Find-And-Replace
utility to just change all affected table names to the base query name.
Main remaining problems that I can think of are:
--------------------------------------------------------------------------
----
- The Admin screens where a user might try to add a lookup table row whose
unique name is already there in one or more "deleted" rows.
as long as there is a unique index on the field which holds the name values,
the user won't be able to do it. if there's a possibility that a record
could be "deleted" and then legitimately need to be "re-added" as some later
time, just write a procedure in the form's Error event to trap the
"duplicate value error" which will be generated on the unique table index.
then automatically remove the flag from that existing record and requery the
form's Recordset to display it; or you can ask the user for confirmation
first, then do it.
>
- Some sort of pseudo RI issue where a user "Deletes" a lookup table row
that is
used by one or more non-deleted other table rows - causing various
queries to
return Null for the looked-up value.
if relational integrity is enforced, that can't happen. if users are
sophisticated enough to question why a "lookup" table record can't be
deleted, especially with hundreds of thousands of records in the data
tables, then they should also understand the explanation.
>
My kneejerk is to just not implement the flag system for lookup tables and
live
with it if a user trys deleting a row that's used by a "Deleted... " record
somewhere.
well, i'm assuming you've given user the ability to "clean up" the lookup
tables because they don't want to see obsolete choices in combobox droplists
and/or listboxes. to me, the bigger issue is how to prevent data entry users
from *choosing* (even by accident) obsolete droplist options because those
items can't be deleted. if users can only *look* at historical data but
never change it, it's easy enough to flag and hide "deleted" records in data
entry form droplists. but if historical data *can* be changed, it's a
tougher issue. in that case, probably the easiest solution (from a
programming standpoint) would be to flag the records as obsolete and call a
global function to check selected options on all combobox/listbox controls'
BeforeUpdate events and block selection of obsolete values, with a msgbox
for the user.
--------------------------------------------------------------------------
----
>
I'm thinking a field named "DeleletedA t" - which would be Null or contain
a
timestamp and "DeletedBy" , which would be Null or contain a LAN UserID.
sure, why not, if it's important to track who deleted a record. just
remember that using two fields in the flag doubles the work of removing the
flag to "re-add" a record, if/when necessary.
>
I'd also think that the flag sb used only at the top of hierarchical
relationships. No sense "Deleting" child records if the parent is
flagged
as deleted because the user will never see same.
true enough. you'll have to analyze the business process (if you haven't
already) from the standpoint of determining whether specific child records
ever need to be "deleted", even though other child records and the parent
should remain active.
>
I would hope that there's no perceptible diff between IsNull(DeletedA t)
and IsDeleted=False . Anybody know? - although I guess I should set
up a
test table with a few hundred thousand recs and try it either way....
if IsDeleted is a boolean (Yes/No) field, i don't see a difference. if
you're concerned about a boolean field somehow reading as Null at the table
level, then you could set the default value of the field to False. then,
from the point of creation, the field will have a True or False value -
unless you specifically set its' value to Null (haven't tried it, i don't
know if that's possible).
hth
--
PeteCresswell