Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 10th, 2006, 02:21 PM
Authorized User
 
Join Date: May 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formatting Data Entry in forms

Is there a way to format a data field to accept Lastname, then when hitting the spacebar a comma is inserted and the next word starts which is the Firstname when the user is entering it in so that it displays in the following format “Smith, John” (>L<??????, >L<??????) within the one data field? If so what is the approach and what control do you insert it under?
 
Old May 10th, 2006, 02:27 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

The problem that you might have with this approach is that some people have Last Names that have more than one name, like Van Dusen or something.

What about the following approach... (I believe it is possible)
Have 3 fields, First name, Last Name and Name
First Name and Last Name are Unbound, but bind the Name field to the field in your database and set the Text to =[txtLastName] & ", " & [txtFirstName].
If that doesn't work have the user enter the Last Name first, on the lost focus event, set the Name field to the Last Name, and then on Lost Focus for the First name, set the Name field equal to Name & ", " & FirstName

Hope that helps,

Mike

Mike
EchoVue.com
 
Old May 11th, 2006, 10:27 AM
Authorized User
 
Join Date: May 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for the suggestion the data field I am trying to apply this to is an Emergency Contact name which I would like to leave as a one entry field however you did bring up a good point that I haven't considered regarding the last name that I will have to incorporate into my database. Is there a way to apply the above mentioned formatting into one field or maybe if anyone knows where I may get additional information regarding the issue please let me know?
 
Old May 11th, 2006, 11:42 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You can do LastName and FirstName fields, then when you want to display the name, just use the regular expression in a query for your report, like Name:([LastName] & ", " & [FirstName])

You shouldn't have to do this kind of kludge for data entry. It is not normalized anyway.

TM2C


mmcdonal
 
Old May 11th, 2006, 03:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

MMcDonal is correct, aRtware. Never store full names in one field. Always separate them into first and last names in tables. If you need that "Last, First" structure for a report, then create an unbound textbox that does that and hide the first and last name textboxes.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old May 12th, 2006, 09:16 AM
Authorized User
 
Join Date: May 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for the suggestions I will update my database to follow suit.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting in Continuous Forms Balasarius Access 3 September 19th, 2008 07:06 AM
Forms or a solution for end user data entry? Scott B SQL Server 2005 0 October 19th, 2007 04:21 AM
error in data entry vickyj SQL Server 2000 6 September 13th, 2004 10:02 AM
Database entry from HTML forms gmoney060 Classic ASP Basics 4 March 31st, 2004 04:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.