Re: Creating history record
- From: "tina" <nospam@xxxxxxxxxxx>
- Date: Sat, 20 Aug 2005 00:27:03 GMT
well, until the current record in the form is written to the table, what
you'll see in the form is the edited data, but what's stored in the table is
still the "old" data. try writing an Append query that pulls the data
directly from the data table into the history table; set a criteria on the
primary key field to pull that value from the form, as
WHERE MyFieldName = [Forms]![MyFormName]![MyFieldName]
substitute the correct form name and primary key field name, of course. in
the macro on the Save button, use the Actions in the following order:
SetWarnings (On = No or False)
OpenQuery (run the Append query)
SetWarnings (On = Yes or True)
SaveRecord (save the current record in the form)
if you use the Save button to save *new* records, as well as saving changes
to existing records, you MAY get an error on the OpenQuery action (i haven't
tested this solution, so can't say for sure). if you do, post back and we
can probably fix it.
hth
"leturner" <leturner@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4B2D9CB3-E69D-4430-B9BC-06A31F6D45E6@xxxxxxxxxxxxxxxx
> Steve,
> I will give this a shot.
> The reason I need to wait until they hit the save command is that they
have
> an undo key if can they change their minds during the update. They could
hit
> either key. No update, no history.
> I'll let you know how things turn out.
>
> Thanks
> --
> leturner
>
>
> "Steve Schapel" wrote:
>
> > Larry,
> >
> > You can use an Append Query to put a copy of the existing record into
> > the history table. I guess it would seem logical to me to do this prior
> > to editing?
> >
> > --
> > Steve Schapel, Microsoft Access MVP
> >
> >
> > Larry T. wrote:
> > > I have a form that allows the user to update a record. I have used a
command
> > > button to perform this function. Now the user wants the before image
to be
> > > saved to another table for history. I have saved all fields prior to
any
> > > changes. The problem I now have is using that save information to
update the
> > > history data base. I would like to have it all done using the save
command
> > > button. In other words;
> > > save updated record, than save history record using before images.
> > > Thanks for any help.
> >
.
- Follow-Ups:
- Re: Creating history record
- From: leturner
- Re: Creating history record
- References:
- Creating history record
- From: Larry T.
- Re: Creating history record
- From: Steve Schapel
- Re: Creating history record
- From: leturner
- Creating history record
- Prev by Date: Re: Filtering records based upon another table
- Next by Date: Formatting Table Fields With Macro
- Previous by thread: Re: Creating history record
- Next by thread: Re: Creating history record
- Index(es):