?
Solved

Field on form that looks up a form

Posted on 2014-04-16
4
Medium Priority
?
290 Views
Last Modified: 2014-04-19
I have a form that includes all my customers contact information, about 1,500 of them.

At the top of the form, I'd like to be able have a form that when you enter the Last name then First name of the client, it pulls up that record. The two table values of Last and First.

Also, as you type the last name, I'd like it to predict which client you are referring to. If two clients have the same last name and first name, I'm not sure how it would deal with.

Thanks for any info you have!
0
Comment
Question by:cansevin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye earned 2000 total points
ID: 40004912
I frequently use a combo box in the form header for this purpose.

I set the query to something like:
SELECT UnionName.ContactID
, UnionName.FullName
FROM (
SELECT ContactID, [LastName] & ", " & [FirstName] as [FullName], 1 as Seq
FROM yourTable
UNION ALL
SELECT ContactID, [FirstName] & " " & [LastName] as [FullName]2 as SEQ
) as UnionName
ORDER BY UnionName.SEQ, UnionName.FullName

Open in new window

Then, set the column count = 2
The bound column = 1
and the column widths to 0, 2

Now, when you type into the combo box, whether you type:

Smith, John

or

John Smith

You will get the type ahead feature

Finally, in the AfterUpdate event of the combo, do something like:
Private Sub cbo_ContactFind_AfterUpdate

    With me.recordsetclone
        .FindFirst "[ContactID] = " & me.cbo_ContactFind
        if .nomatch = false then 
            me.bookmark = .bookmark
        else
             msgbox "Contact not found!"
        endif
    End With

End Sub

Open in new window

0
 

Author Comment

by:cansevin
ID: 40010612
Thanks fyed... I am going to try to conquer this today. Are you around to help out? There are a few things in the code I don't understand.
0
 

Author Comment

by:cansevin
ID: 40010616
In the querry select, after the is there a comma and space after the [FullName]? For the first one it is

[FullName], 1 as Seq
FROM yourTable

The 2nd one it is:
[FullName]2 as SEQ
) as UnionName
0
 

Author Closing Comment

by:cansevin
ID: 40010859
Thanks!
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question