Refresh a form

Kenln

Registered User.
Local time
Today, 14:17
Joined
Oct 11, 2006
Messages
551
I have a form who's source table has 4000 records.

These records are updated via
Code:
DoCmd.OpenQuery
rather than through the field directly.

Because of this the form does not reflect the changes.

I want to refresh/requery the fields and stay on the same record.

How to a Requery/Refresh without causing the form to return to 1st record.


Thank you for your help,
 
P.S.

I have tried Me.Refresh and Me.Refresh followed by Me.Repaint.
 
You cannot... requery will always revert to the first record.

However... you could store the PK in a variable.
Then so a search for the PK and jump to it ... thus displaying the right info...

The right info though should already be on the form right? If not, why not make the form bound?
 
If the PK is multiple fields how do I jump to that?

The standard (wizard) code is:
Code:
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Job_No] = '" & Me![cbo_Job_Number] & "'"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark

But my PK would be Company, Division, Job and Segment, four fields?

Can I modify the above using simple 'Ands' or commas?
 
Yes simply use ands....

rs.FindFirst "[Job_No] = '" & Me![cbo_Job_Number] & "' and [someotherfield] = "

etc...
 
Awesome.

Again I am embarassed by not realizing I could do something so simple.

Thank you again,
 

Users who are viewing this thread

Back
Top Bottom