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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open 2nd form with records "LIKE" name typed in popup 1

Status
Not open for further replies.

Carina1628

Technical User
Nov 12, 2002
16
US
Hi all-

I have searched for an answer in this site, but can't find a similar problem.

I have a large database that was created with the name field as "Last, first". Unfortunately, with the diversity of entries, I can't split this field out.

I want to be able to pull up all the records with a last name similar to the one typed in a pop-up box. It worked with Deed#'s, but that was an exact match.

Here is the code I have:

Private Sub cmdMatchingNames_Click()
On Error GoTo Err_cmdMatchingNames_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "DataEntryFilterName"
stLinkCriteria = "Owner =" & "'" & Me![OwnerName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdMatchingNames_Click:
Exit Sub

Err_cmdMatchingNames_Click:
MsgBox Err.Description
Resume Exit_cmdMatchingNames_Click

End Sub

[OwnerName] is the field on the popup, [Owner] is the field I am searching in. I have tried using "Like" and wildcards, but I am not getting them in the right spot.

Can anyone help?

Much Appreciation,
Carina
 
Have a look at
Thread702-563930

Hope this helps
Hymn
 
I have a lookup form that I use all of the time that searches through the records based on what you type in the Search field. You can double click the record and that record will be selected in the main input form. I can send you what I have and you could modify it to work for you.

I posted a snap shot of it on
 
Have you tried this ?
stLinkCriteria = "Owner Like '*" & Me![OwnerName] & "*'"
If you want the name starting with the type text:
stLinkCriteria = "Owner Like '" & Me![OwnerName] & "*'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank You PHV!

I knew it was just the way I was putting my "Like" statement together. Your suggestion worked exactly how I needed. Thanks Again.

Carina
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top