Requery Subform and recordset

G

Guest

Access 2002 user. I have tried to understand the many posts concerning this
situation, but can't seem to understand how to make it all work.

I have a main form titled frm_by_Lead with a sub form titled
qry_View_CCAT_Status. with a command button to open a popup form that "when
dirty" writes the modification date to the record selected on the subform.
This changes the record selector in the subform to a pencil. I need to save
this record. Only option that I can get to work is the requery option, but
it moves the pointer to the first record in the subform. I would like the
record pointer to goto the record previously selected after the requery.

The link between the popup form and the subform is a field called SR. The
ON CURRENT event of the subform writes the field SR to Forms![Temp].[SR]. So
the requery resets Form![Temp].[SR] vaule.
The SR field contains values of test, test1, test2, test3.

I don't necessarily need to requery, just save the selected record (when
popup form is closed) to change the pencil to a triangle to unlock the
record. I have tried this solution, but get the error, "Jet engine does not
recognize "test" as a valid field name.
This code executes in the ON CLOSE event of the popup form.

'***************************************
If CurrentProject.AllForms("frm_by_Lead").IsLoaded Then

'* tempmark is declared elsewhere, but copied here for reference.
'Dim tempmark
'tempmark = Forms![Temp].SR

Forms![frm_by_Lead].Requery
With Forms![frm_by_Lead].[qry_View_CCAT_Status].Form.RecordsetClone
If .RecordCount > 0 Then
.FindFirst "SR = " & tempmark
If Not .NoMatch Then
Forms![frm_by_Lead].Bookmark = .Bookmark
End If
End If
End With
' MsgBox "frm by lead requery complete"
'End If

Exit Sub
End If
'************************************

Any assistance you can provide is GREATLY appreciated.
 
G

Guest

Please disregard, I just read a post by Chris Reveille titled Requery a
subform.

Instead of all this, a simple
Forms![frm_by_Lead].[qry_View_CCAT_Status].Form.Refresh did the trick.

syntax is Forms!MyForm!MyControl.Refresh
 

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