[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Field on form that looks up a form

Posted on 2014-04-16
4
Medium Priority
?
294 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

649 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