Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requery applying a filter

Status
Not open for further replies.

lmcc007

Technical User
May 7, 2009
164
US
Everytime the below code runs, it filters the first record (1 of 1). I removed all filters from the form and so on. When I close form 2, I want form 1 to show the changes, and I want to return the record I was on.

Private Sub Form_Unload(Cancel As Integer)

On Error GoTo ErrorHandler

If CurrentProject.AllForms("fmainCompany").IsLoaded Then
Forms!fmainCompany.Requery
End If


CleanUpAndExit:
Exit Sub

ErrorHandler:
Call MsgBox("An error was encountered" & vbCrLf & vbCrLf & _
"Description: " & Err.Description & vbCrLf & _
"Error Number: " & Err.Number, vbCritical, gstrAppTitle)
Resume CleanUpAndExit

End Sub

What could be the problem?
 
forum702

The above forum is probably a more appropriate place for this question.


That Being said I am not sure what you are trying to do...

Do you want to when the current form closes, update and navigate to the associated record on the closing form?

In this case you would want to requery the form as in your code and then use a bookmark, recordsetclone and find method to navigate the form as demontrated by the wizard for a combobox that finds a result.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top