Solved

Displaying Name in Text box

Posted on 2011-03-04
8
299 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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
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
 

Author Comment

by:Chrisjack001
ID: 35037968
Where on the form should I put this code
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 119

Expert Comment

by:Rey Obrero
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 119

Accepted Solution

by:
Rey Obrero 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

947 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now