A tricky one with recently viewed records?

B

bilbo+

Hi there, I've got a bit of a strange request since im not sure its possible.
Basically we have a database that lists all our current jobs and quite often
when there are a few going on we are always switching to and from record and
each time removing filter and filter for a certain job no. I'd be happy to
listen to any quick suggestions on how to get to them quicker , maybe a pop
up box or something but i was thinking is there a way of maybe haveing a
little subform on the side that refreshes every couple of minutes and puts
the latest viewed record no. and maybe a couple of other fields there that we
can easily just click on to go back to them?

thanks in advance for any help and suggestions

Will
 
A

Allen Browne

Your form is bound to a table that has a primary key field. We will assume
this is a numeric field (such as an AutoNumber.)

Create another table to log the primary key value of each record you visit.
This logging table will have fields such as:
LogID AutoNumber (primary key)
KeyID Number (foreign key)
LogDateTime Date/Time (when visited)

The KeyID will contain the value of the key field. This must not be a
required field (since the new record will have a Null key value), must not
be uniquely indexed (since the user may visit the same record more than
once), and must not have relational integrity to your main table unless you
use cascading deletes (since the user may visit records that are later
deleted.)

Use the Current event of the form to execute an Append query string to add
the record to this logging table. This kind of thing:
Private Sub Form_Current()
Dim strSql As String
strSql = "INSERT INTO tblLog ( KeyID, LogDateTime ) " & vbCrLf & _
"SELECT " & Nz(Me.[ID], "Null") & " AS KeyID, Now() AS LogDateTime;"
dbEngine(0)(0).Execute strSql, dbFailOnError
End Sub

Now you can create a query using the logging table, and set the Top Values
property (Properties box, in query design) so that it shows only the TOP 10
(or whatever) records, sorted by LogDateTime.

You can then code the DblClick event (or whatever) of the subform to
FindFirst that key value in the main form, or go to the new record if the
key value was null.
 

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