We help IT Professionals succeed at work.

Look Up in Form

camco
camco asked
on
I have a form that has two sub forms. The subforms use the same table for the record source. I would like a field that you could enter text and have it find a record in one of the two subforms based on the text that you enter in the look-up field.

Thanks for the help!
Ward
Comment
Watch Question

Commented:
Just create a lookup textfield and add a "Lookup" button per subform.

The button can issue a filter command like:

me.sfrmSubform1.Form.Filter = "FieldA like '*" & me.txtFilter1 & "*'"
me.sfrmSubform1.Form.FilterOn = True

Same goes for the second button.
This will search the FieldA matching your txtFilter1 value even for a part.

Is that what you need?

Nic;o)

Author

Commented:
Is the txtFilter1 in "me.txtFilter1" the name of my unbound text box that I enter the search criteria in?

ward

Commented:
Correct Ward.
I anticipated on possibly two separate fields, one per subform...

Nic;o)

Author

Commented:
Hi Nic,

This is waht I have but when I click on the button I get  an error meassage compile error. method or data member not found. It highlights .txt34 in yellow.

Private Sub Command37_Click()

Me.Subform1.Form.Filter = "OrderNumber like '*" & Me.txt34 & "*'"
Me.Subform1.Form.FilterOn = True

   
End Sub

Thanks Again!
Ward

Commented:
Goto the field txt34 on your form in editmode and right-click it to select the properties.
There goto the "Other" tab and check or the name is effectively "txt34".
Also check this for the OrderNumber on the subform1.

Nic;o)

Author

Commented:
They have the same name. I am stumped
Commented:
Can you drop this .mdb compacted and zipped in my nico5038 mailbox "at" yahoo.com and I'll have a look.

Nic;o)

Author

Commented:
Thanks a million!!!
Ward

Commented:
You're welcome ;-)
Just try to be very secure on the names you use and prefixing/renaming fields and other objects will really pay-off !

Nic;o)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.