How to Update Records on a form

  • Thread starter Thread starter doyle60
  • Start date Start date
D

doyle60

I have three people working on the same form (with several subforms).
The trouble is that they don't see each other's added records. What
is the best way to update the form's records but also not take them
off the current record?

Thanks,

Matt
 
You could use the Form After Insert event to update the underlying table
whenever a new record is added. It will also update the user's form with
records that have been added since the user last added a record. For example
purposes, I will assume a Long Intger primary key field named ClientID and a
hidden field on the form to contain the field named txtClientID

Private Sub Form_AfterInsert()
Dim lngClientID As Long

lngClientID = Me.txtClientID
Me.Requery
With Me.RecordsetClone
.FindFirst "[ClientID] = " & lngClientID
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Sub
 
Thanks. But one user may not have added a record and could be just
editing some records or not editing at all but looking about. I want
this person to be able to update her form which she may have had open
for five hours or so adding no records while two others have added
records in the mean time.

So I need a command button to do this. Would the code above work on a
command button?

Thanks,

Matt
 
On Tue, 24 Jun 2008 06:57:15 -0700 (PDT), "(e-mail address removed)"

If they need to remain on their current record, what difference does
it make if someone else has added others? It appears this might only
be of interest after they move off of their current record. If I'm
right, you could offer a Requery button, or do that action
automatically in the Form_AfterUpdate event. If you then want to stay
on the same record, simply save the PK value to a local variable,
requery, and move back to that record.

-Tom.
 
You're right but not quite, I think. They may not have entered a new
record or updated a record all day but opened the form four hours
before. Others may have added new records in that time. It would be
nice if a command button would update the form with new records but
allow them to stay on the one they are looking at. That way they can
easily go back to the record they were on while they had to peek into
a new record. You see, I have a button that toggles between the
record you are on and the last one you viewed. So I want to shake the
form up, have the Look Up command box update with new records and have
the actual form update and leave them where they are. What would be
the code for that?

I could have the code run everytime they go into the Lookup. But my
code for that does not update the form and when I try updating the
form it annoyingly sends the form to record one. I don't want that.

Thanks,

Matt
 
You shouldn't have to worry about that. In Tools, Options, Advanced tab,
there is an option named Refresh Interval. This determine how often a form's
recordset is automatically updated. The default is 60 seconds, so once every
minute, each user's recordset will be updated with any records added by other
users.
 
Back
Top