Consulting

Results 1 to 4 of 4

Thread: Generate number when userform information is submitted

  1. #1
    VBAX Newbie
    Joined
    Aug 2013
    Posts
    2
    Location

    Generate number when userform information is submitted

    I am new member on this site and pretty new to VBA.

    I have created a MultiPage UserForm to enter a client's personal information for transfer to a Data Base. I am using 2 separate workbooks to do this - one that houses the UserForm and one that houses the Data Base. I am successfully managing to get the information entered on the UserForm to go to the Data Base.

    But, I need two operations to follow when the CommandButton 'Submit' is clicked:
    1) On Submit, in the first column allocate a unique number or ID to the client whose information is being submitted
    2) On Submit, calculate the client's age based on the Date of Birth field entered on the UserForm

    Am looking forward to your advise.

    Thanks

  2. #2
    VBAX Newbie
    Joined
    Aug 2013
    Posts
    2
    Location
    Apologies, it has been pointed out to me that I have been cross-posting as I indeed have, and how uncool that is.

    I have managed a work around to allocate a unique number for each time a client's information is capture. Not sure that it is the best way to do this, but for now it works. I posted the work around on the Excel Forum site. Unfortunately this post is not allowing me to link to the site.

    Apologies again.

  3. #3
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Hanret, The FAQ link at the top includes Forum etiquette rules. I think you can add a link after two posts.

    If the client ID number is in sequential order just retrieve the Max(ID_Column) value and add 1.

    Age can be calculated by merely subtracting DOB from Now. For information on dates, Type "Date" in the VBA Editor, (VBE,) leave the cursor inside the word and press F1. In the help page that comes up, click the "See Also" link at the top. Also do this for NumberFormat.

    For more specific help from us, we'll need more specific information from you, such as, how the DOB is entered on the Form, and a sample of the Database Sheet.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  4. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •