?
Solved

Displaying Name in Text box

Posted on 2011-03-04
8
Medium Priority
?
344 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

864 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