By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,688 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

Building a Name | Same as Last Field

P: 1
I would appreciate help with these questions:

(1) I want to "build" a name; that is, I want to enter the first name in one field, then middle name in the next field, last name, suffix (if any), and then I want the "full name" field to put the whole name together without re-keying it in.

(2) I want same as last field; that is, I want to key-in the last name, and in a later field I want that last name to show up in ALL CAPS, without re-keying in the last name in all caps. I can make the ALL CAPS with > in the format entry.

(3) Calculating age; that is, I want to key-in the birthday in one field and then in anther field the age is automatically calculated based on the birthday field.

(4) Yes/No linked to other Fields; that is, I want to ask something like "Is the mailing address the same as the residence address?" and if yes, then the residence data is automatically entered into the mailing data fields.

Thank you in advance for your time and effort.
May 5 '14 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,240
XOVERX,
Welcome to Byes.com. Thank you for being clear with your question. Asking the question properly goes a long way toward getting an answer.

I will give you a few clues without giving you the entire solution. First, you need to understand the concept of "events" and handling events in program code. Understanding the available events on a form (http://msdn.microsoft.com/en-us/libr...ffice.15).aspx for Access 2013, most events have been the same for a long while) will help you to figure out which events pertain to what you want to do.

Let me suggest that for item number 1 on your list you look at the AfterUpdate event of each of the name text boxes. You could call a subroutine from each of those functions so that whenever one of those name fields is changed the whole name is redisplayed in the format you want.

AfterUpdate would also work well for Item number 2. In that same AfterUpdate event for the last name text box, where you will have something like
Expand|Select|Wrap|Line Numbers
  1. Call ShowWholeName 
You can also add a line
Expand|Select|Wrap|Line Numbers
  1. me.LastNameupcase=UCase(me.LastName)
or, as you suggested, leave out the call to UCase and let the properties of LastNameupcase handle the case conversion.

For Item 3, it is the same event that could be used, the AfterUpdate event of the birthday field. The age will be derived by using the DateDiff function.

Item 4 is a little less clear to me. I think you mean you want to do an if/then test in code for a comparison known in advance. You could add a button to your form and use the Click event of the button to run the code that will contain the if/then code and modify the form objects accordingly. The if/then will be in the form
Expand|Select|Wrap|Line Numbers
  1. if (x=y) then
  2.       do stuff
  3. else
  4.      do other stuff
  5. endif
  6.  
Good luck.

Jim
May 5 '14 #2

zmbd
Expert Mod 5K+
P: 5,397
XOVERX
What is your question exactly?
May 7 '14 #3

Post your reply

Sign in to post your reply or Sign up for a free account.