Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Dlookup and Concatenating Firstname Lastname
Innes Palm 
     
4 months ago
Hello Forum,
I need to concatenate separate user FirstName and LastName field data, from a UserTable (UserT), into a  single FullName field, on a contact history log (continuous subform) - TicketDetailF. To clarify, it's a continuous history log, NOT a contact person form.
The main menu (MainMenuF) will always be open as a separate form in the background and contains the current logged on 'UserID' field.
I would personally prefer NOT to use a query or a combo box for this particular solution if I can help it.
I want to insert the DLookUp formula into the FullName field on the contact history log (continuous subform).
Please could I ask if someone could advise what should follow after: =DLookup("UserID", "UserT", ....?
Many thanks! :)
Donald Blackwell  @Reply  
        
4 months ago
If you just want "FIRSTNAME LASTNAME" from UserT your DLookup would be
=DLookup("FirstName & "" "" & LastName", "UserT", "UserID=" & UserID)

If you're trying to look up the first/last that matches the contact record. If you're looking for the first/last of the userid of the person logged on, then it would be:

=DLookup("FirstName & "" "" & LastName", "UserT", "UserID = " & Forms!MainMenuF!UserID)

Alex Hedley  @Reply  
           
4 months ago
Kevin Robertson  @Reply  
          
4 months ago
It is not recommended using DLookup in a Continuous Form. The function would have to run for every record in your recordset and if you have a lot if records can run really slow. If your backend is on , for example, SQL Server then it is going to run extremely slow.

I would build a Query for this with a Calculated Field for FullName.
Innes Palm OP  @Reply  
     
4 months ago
Thank you Donald, Alex and Kevin for taking the time to reply (wow that was quick!)
Donald, I couldn't get it to work but I think it might be down to something else I've not yet spotted on my side, either tweaking the code or something else in the database. I will let you know when it does but for now I'm going to take Kevin's advice and switch back to using a query instead, so the database runs efficiently. Thanks for pointing that out Kevin. Thank you all again for your contributions - it is most appreciated :)
Innes Palm OP  @Reply  
     
4 months ago
Hi again. So, as suggested, I created a calculated field in a query (for the continuous subform with the contact history log) and this worked: it populated the Fullname field on the continuous form with the current user's Fullname.
However, after a different user logs on, and if the contact history subform is reopened, all the Fullname fields of all the previously logged records are overwritten with the current user's Fullname.
How do I get it to leave the previous records alone and only add the current user Fullname to the current (new) selected record on the continuous subform when the form loads.
For info: I'm actually using 'LoggedBy' as field name instead of Fullname; so then the calculated field in the query for the continuous subform is:
LoggedBy: DLookUp("FirstName & "" "" & LastName","UserT","UserID=" & [Forms]![MainMenuF2]![txtUserID])
Alex Hedley  @Reply  
           
4 months ago
Why do you think it's changing?
Innes Palm OP  @Reply  
     
4 months ago
I think it makes sense as in that he query is commanding the LoggedBy field on the continuous form to search the UserID of the current logged on user and update to their UserID as soon as the form loads. This outputs the User's concatenated fullname which is fine for the current record.
It's evident that I've not done something to instruct it to only affect the current (new record) with the current UserID.
I've trawled through lots of code in the 599cd forums, searched the topic several different ways. Tried Before Update, also tried editing the allow edits option in the properties section for that field. Considered but unsure how to use the On Current event in VBA but come up with nothing yet.
Alex Hedley  @Reply  
           
4 months ago
You'd need to have a Field in your Table called UserID that you set when the Record is created.

You could then use a Query to pull in the First/Last from your UserT.
Innes Palm OP  @Reply  
     
4 months ago
Okay, that has worked! Thank you Alex.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/7/2026 12:55:58 PM. PLT: 0s