Need to combine text field with a date field please

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • terbolee
    New Member
    • Jan 2007
    • 23

    #1

    Need to combine text field with a date field please

    I have a [OrgCode] text field and a [InvDate] dd/mm/yyyy field. My third field [InvNum] needs to be automatically filled in with the first 3 chars of [OrgCode] and mmdd of the [InvDate] field.

    Here's an example: "CASTOR" in [OrgCode] & 15/01/2007 in [InvDate]

    I need "CAS0115" in [InvNum] as an After Update Event.

    Can you help? Thankx.
  • Phille
    New Member
    • Jan 2007
    • 22

    #2
    Hi

    I have no idea in what you are trying to do this but if you have a form
    you make your textbox/field whatever named InvNum which Control Source you specify as following

    =Left([InvCode];3) & Left([InvDate];2) & Mid([InvDate];4;2)

    Hope it helps

    Comment

    • Phille
      New Member
      • Jan 2007
      • 22

      #3
      I just realised that you wanted to invert the months with the days
      so then it should be:

      =Left([InvCode];3) & Mid([InvDate];4;2) & Left([InvDate];2)

      ; )

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        An alternative would be
        Code:
        =Left([InvCode],3) & Format([InvDate],"mmdd")
        An interesting point here is that Phille uses the ';' to separate parameters (as I've noticed some others do) but my system only uses ','. If one doesn't work for you swap them for the other.

        Comment

        • Phille
          New Member
          • Jan 2007
          • 22

          #5
          Hi NeoPa

          I've always wondered why the hepfile examples used commas when my machine just keep giving me errors when I use them. Now when I look at my regional settings (which are finnish) I see that my list separator is ' ; ' while it can be changed to a ' , ' . Wierd! I have always thought that codes shuld be universal?? Anyone knows the truth?

          By the way, thanks for the format command, hadn't realised it.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #6
            Thanks.
            List Separator - that's what it is!
            I'm pleased to have helped - the Month() & Day() functions can be useful but where more than one is required in the output the Format() function is generally a better solution.

            Comment

            Working...