Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2008

    Unanswered: Need to create JCN with format yyyymmddnnss

    Hello, I need to create a job control number with the format yyyymmddnnss when I open a form. This will be the key field for a maintenance data record. I tried concatenating five text boxes on the form with default values set to:
    • txbJCN_yyyy = DatePart("yyyy",Now())
    • txbJCN_m = DatePart("m",Now())
    • txbJCN_d = DatePart("d",Now())
    • txbJCN_n = DatePart("n",Now())
    • txbJCN_s = DatePart("s",Now())

    The format of all boxes is set to 00, and the displayed values are preceeded with a zero when needed. The expression JCN=[tbxJCN_yyyy] & [tbxJCN_m] & [tbxJCN_d] & [tbxJCN_n] & [tbxJCN_s] produces 20084567 rather than the desired 200804050607. I could not force preceding zeros to maintain 12 characters using this method, which is required to maintain compatability with another system.

    Any help on this would be appreciated.


  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    I'd suggest you use a format mask instead

    jcnvalue = format(now(),"yyyymmddHHMMSS") 'this may be wrong.... check the help system for details
    im not to sure what your nnss should be, I'm guessing they are time
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Dec 2008
    Thanks! Works great. I had tried the Format function, but could not get it working. I had the syntax slightly off. I did not find the Help helpful. :-) I now have JCN = Format(Now(),"yyyymmddmmss").


  4. #4
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    Not find Access Help helpful? I don't understand this at all! I've always found it to be as useful as a deckhand on a submarine!

    (Actually, being from Down South, I wanted to say as useful as **** on a boar, but I know we have ladies here and didn't want to offend!
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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