Access97 VBA newbie question 
Author Message
 Access97 VBA newbie question

Hi all,

I've got a question.

I've created a database in Access97.
What I need to do is the following:
After a field in a record has been changed I want to fill the History-field
with a Time Stamp. This because we want to keep 3 historyrecords on file. If
an updated field passes the three history records it needs to delete the
oldest one. What is the smartest way of doing this?

Thanks in advance, Raymond



Fri, 01 Apr 2005 20:30:19 GMT  
 Access97 VBA newbie question
Time-stamping the History field is simple enough:  just put code in
the form's BeforeUpdate event saying something like

    Me!History = Now()

But where have you arranged to save your history?  Do you have a
History table, separate from the table your form is based on?  How are
you currently saving records into the History table?  I'd probably be
looking at a three-step process:

1. In the form's AfterUpdate event, execute an append query to copy
the record that was just saved into the History table, selecting the
record by primary key.

2. Determine whether there are more than three records for this key in
the history table.

3. If so, run a delete query to delete the oldest one.

Or I could use a recordset on the History table to do the job, if that
turns out to be easier or more efficient -- though executing queries
is usually faster.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


Quote:
> Hi all,

> I've got a question.

> I've created a database in Access97.
> What I need to do is the following:
> After a field in a record has been changed I want to fill the
History-field
> with a Time Stamp. This because we want to keep 3 historyrecords on
file. If
> an updated field passes the three history records it needs to delete
the
> oldest one. What is the smartest way of doing this?

> Thanks in advance, Raymond



Sun, 03 Apr 2005 00:03:14 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Newbie Access97 VBA question

2. ┬žnewbie question: access97 join types

3. Access97 vba VS Access2000 vba

4. Access97 VBA and Word VBA

5. vba Newbie Question

6. Newbie question... add-ins and VBA

7. Newbie VBA question

8. newbie question - word vba

9. VBA question from newbie (Please Help)

10. newbie question - Jet VBA failed to intialize

11. Newbie question about VB5, VBA and EXCEL97

12. VBA newbie question

 

 
Powered by phpBB® Forum Software