Remove filter without loosing focus

  • Thread starter Thread starter Access::Student
  • Start date Start date
A

Access::Student

Hi, I've got an issue that I can't figure out.

I've got a button on a form that I created using the button wizard that has
the following code:

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PEOPLE"
stLinkCriteria = "[kp_people_id]=" & Me![kf_from_id]
DoCmd.OpenForm stDocName, , , stLinkCriteria

This just takes me to the related Form in People. the problem I've got is
that it applies a filter to people and only show's one record. I want it to
show all. I've tried using "DoCmd.ShowAllRecords" but I lose my current
record if I do that. Is there a better way? I want to be able to click the
button, go to the other form, and be on the record I want but with no filter
present.
 
Access::Student said:
Hi, I've got an issue that I can't figure out.

I've got a button on a form that I created using the button wizard that
has
the following code:

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PEOPLE"
stLinkCriteria = "[kp_people_id]=" & Me![kf_from_id]
DoCmd.OpenForm stDocName, , , stLinkCriteria

This just takes me to the related Form in People. the problem I've got is
that it applies a filter to people and only show's one record. I want it
to
show all. I've tried using "DoCmd.ShowAllRecords" but I lose my current
record if I do that. Is there a better way? I want to be able to click the
button, go to the other form, and be on the record I want but with no
filter
present.


Try code like this:

'----- start of code -----
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "PEOPLE"
stLinkCriteria = "[kp_people_id]=" & Me![kf_from_id]

DoCmd.OpenForm stDocName
Forms(strDocName).Recordset.FindFirst strCriteria

'----- end of code -----
 
Back
Top