SubForm on Form

  • Thread starter Afrosheen via AccessMonster.com
  • Start date
A

Afrosheen via AccessMonster.com

I found a program on this board that will find a person by last name. Here is
the code:

Private Sub txtFind_AfterUpdate()
10 On Error GoTo txtFind_AfterUpdate_Error

20 If Len(txtFind) > 0 Then
30 Me.Filter = "[lname] Like ""*" & txtFind & "*"""
40 Me.FilterOn = True
50 Else
60 Me.FilterOn = False
70 End If

80 On Error GoTo 0
90 Exit Sub

txtFind_AfterUpdate_Error:

100 MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure txtFind_AfterUpdate of VBA Document Form_frmEmployee_Tab"
End Sub

It works great when it's on the main form. It displays the information I need.


I have created a subform with the same code. The problem is that when I put
in the last name to "search" on the subform, it doesn't show a match on the
main form which I want it to do.

Any help would be appreciated. I thank you for reading my post. Everyone has
been a great help.
 
J

Jack Leach

You need some way to tell the mainform to go to that record, it won't do it
automatically. I think this is usually done by using the
recordsetclone/bookmark method.

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
D

Dale Fye

Personally, I frown on using a search functionality on a subform that changes
the record on the main form. Why don't you just implement this search
capability on the main form?
 
A

Afrosheen via AccessMonster.com

Thanks for all your replies. I gave up on the program. It was to flaky


Dale said:
Personally, I frown on using a search functionality on a subform that changes
the record on the main form. Why don't you just implement this search
capability on the main form?
I found a program on this board that will find a person by last name. Here is
the code:
[quoted text clipped - 26 lines]
Any help would be appreciated. I thank you for reading my post. Everyone has
been a great help.
 

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