Solved

Displaying Name in Text box

Posted on 2011-03-04
8
312 Views
Last Modified: 2012-06-22
I have a form in a database that I want the name of the user display in a text box when that user inputs their Person_Nbr and select a Month/year date. The source of the names are in the NAME field of the ppm table. Example when the user inputs 11111 as Person_Nbr the name that should display should be Melanie Davies in the Text box. Attached is the Database. Can you please help me accomplish this goal. I have tried different methods but I could not still get it to work. Thanks
Database11.mdb
0
Comment
Question by:Chrisjack001
  • 4
  • 4
8 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35036901
your db is working, when you enter the number in txtPerson and select a date from the combo box..

what is it that you want as an alternative?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35036927
you can try this,

Private Sub txtPerson_AfterUpdate()
Dim strsql
strsql = "Select * from ppm where person_nbr = " & Me.txtPerson
Me.RecordSource = strsql

End Sub
0
 

Author Comment

by:Chrisjack001
ID: 35037905
I want the name of the Person associated with that Person_Nbr to display in the text box above
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:Chrisjack001
ID: 35037968
Where on the form should I put this code
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35038002
first remove the Control source of the textbox, then use this codes

Private Sub txtPerson_AfterUpdate()


Me.Text18 = DLookup("[name]", "ppm", "person_nbr = " & Me.txtPerson)
End Sub
0
 

Author Comment

by:Chrisjack001
ID: 35038198
It works great. Is it possible to flip the Last Name, First name around and for it to display it as
Payroll Payment for "FirstName LastName"
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 35038246

Private Sub txtPerson_AfterUpdate()
Dim strName As String
strName = DLookup("[name]", "ppm", "person_nbr = " & Me.txtPerson)

Me.Text18 = Trim(Split(strName, ",")(1)) & " " & Split(strName, ",")(0)
End Sub

0
 

Author Closing Comment

by:Chrisjack001
ID: 35038405
Thank you very much for your help. You were patient, professional and very knowledgeable about the problem.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

803 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