Building a Name | Same as Last Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • XOVERX
    New Member
    • May 2014
    • 1

    #1

    Building a Name | Same as Last Field

    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.
    Last edited by zmbd; May 7 '14, 09:39 PM. Reason: [Z{One question per thread (^_^)}]
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    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
    Code:
    Call ShowWholeName
    You can also add a line
    Code:
    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
    Code:
    if (x=y) then
          do stuff
    else
         do other stuff
    endif
    Good luck.

    Jim
    Last edited by jimatqsi; May 5 '14, 08:36 PM. Reason: typo

    Comment

    • zmbd
      Recognized Expert Moderator Expert
      • Mar 2012
      • 5501

      #3
      XOVERX
      What is your question exactly?

      Comment

      Working...