Form Record Refresh (1 Viewer)

Subwind

New member
Local time
Today, 21:37
Joined
Feb 3, 2018
Messages
6
Hello all. I am having a little issue. I have written a small database for a company that want to contact potential leads for their business. The issue I am having is with a form that is based on a query based on 2 tables. Now, if user 1 edits a record in the linked table, user 2 cannot see these changes and if he tries to then add a some data it fails with duplicate values.

How do I get the form to refresh the data once someone clicks the "Next" button, without it moving back to record 1?

The tables the query is based on are called tblLead and tblCallDetails, the link field is LeadID. When the company makes a phone call, they tick a box for Answer (either yes or no), once this is clicked it adds a record in the tblCallDetail table.
 

Wayne

Crazy Canuck
Local time
Today, 16:37
Joined
Nov 4, 2012
Messages
176
When they tick the Answer Box "Yes", you could have this code in the After Update event:

Code:
Me.Requery

That would give the user the latest data anytime they answer a call. And when he finishes entering his data, you could put the same code in the after update event of the last field in that record as well.
 

isladogs

MVP / VIP
Local time
Today, 21:37
Joined
Jan 14, 2017
Messages
18,209
Using Me.Requery will cause the data to move back to record 1

Instead use
Code:
Me.Recalc
 

Wayne

Crazy Canuck
Local time
Today, 16:37
Joined
Nov 4, 2012
Messages
176
You could use this to return to the same record:

Dim strBkmk As String
strBkmk = Me.YourFieldName

Me.Requery
Me.RecordsetClone.FindFirst "[YourFieldName] = " & Chr(34) & strBkmk & Chr(34)
Me.Bookmark = Me.RecordsetClone.Bookmark

It will return the user back to the same record. I thought using the Me. Requery was needed because he said his form was based on a query.
 

isladogs

MVP / VIP
Local time
Today, 21:37
Joined
Jan 14, 2017
Messages
18,209
.....
It will return the user back to the same record. I thought using the Me. Requery was needed because he said his form was based on a query.

Me.Requery will update the data but it will also return to the first record

Me.Recalc also updates the data but stays on the same record.
Easier than using bookmarks to get back to where you started
 

Wayne

Crazy Canuck
Local time
Today, 16:37
Joined
Nov 4, 2012
Messages
176
I didn't know that. See, you learn something new every day. Thanks for the tip Colin.

Wayne
 

missinglinq

AWF VIP
Local time
Today, 16:37
Joined
Jun 20, 2003
Messages
6,423
Me.Recalc also updates the data but stays on the same record.

Sorry, but to my knowledge, ReCalc does just what it names suggests...it reruns any calculations, i.e. 'calculated fields,' on a given Form...it does not 'update' other data...and I see nothing in the OP's post about calculated data.

Linq ;0)>
 

Users who are viewing this thread

Top Bottom