Newbie Refresh question

C

Cardinal

I split a database and set the back end tables up on a shared network
drive. Then I created mde files and distributed to one other person so
we could test. He entered records and I entered records at the same
time. We both did not see each others records until we closed out our
db's then reopened. Then we saw each others records. I tried the
"Records > Refresh" command and that did not seem to do anything. Is
there any way that a user can refresh the records to see if anyone
entered records while they were entering records? The application is a
room reservation app so it is conceivable that every once in awhile
people could be entering records at the same time. Thanks very much.
 
D

Dirk Goldgar

Cardinal said:
I split a database and set the back end tables up on a shared network
drive. Then I created mde files and distributed to one other person so
we could test. He entered records and I entered records at the same
time. We both did not see each others records until we closed out our
db's then reopened. Then we saw each others records. I tried the
"Records > Refresh" command and that did not seem to do anything. Is
there any way that a user can refresh the records to see if anyone
entered records while they were entering records? The application is a
room reservation app so it is conceivable that every once in awhile
people could be entering records at the same time. Thanks very much.


Refresh shows you changes that others have made to the records that your
form currently displays, but it doesn't show you records that others have
entered new since you opened your form. If you want to see them, you have
to use the form's Requery method, which reruns the form's recordsource
query. Note, though, that requerying also resets your position to the first
record in the query. If you want to requery but remain where you were, you
have to note the primary key of the record you were on, then requery, then
navigate back to that key.

Code to do that would look like this:

'----- start of example code for command button -----
Private Sub cmdRequery_Click()

Dim vRecordID As Variant

' Force record save, if dirty.
If Me.Dirty Then Me.Dirty = False

' Capture primary key of this record.
vRecordID = Me.RecordID ' use your table's key field

Me.Requery

If IsNull(vRecordID) Then

' Must have been at "new record".

If Me.AllowAdditions Then
RunCommand acCmdRecordsGoToNew
End If

Else
' Return to previously current record.

Me.Recordset.FindFirst "RecorID = " & vRecordID

' If RecordID is a text field, use this instead:
' Me.Recordset.FindFirst "RecorID = '" & vRecordID & "'"

End If

End Sub
'----- end of example code for command button -----
 

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

Similar Threads


Top