concatenating

CharlesWhiteman

Registered User.
Local time
Today, 21:27
Joined
Feb 26, 2007
Messages
421
I have two fields which are key to this question; 1) A Customer Code and 2) A Quote Reference.

Both are autonumbered through code as example below:

Quote Reference:
Me!txtQuoteRef.DefaultValue = Nz(DMax("[QuoteRef]", "tblQuotes"), 0) + 1

Company Code
Me!txtCompanyCode.DefaultValue = Nz(DMax("[CompanyCode]", "tblCompanies"), 110) + 1


What i would like to be able to do for the quote reference is create code which concatenates both fields together so that if I have a company code of 130 and its quote ref 3 I get a quote ref of 1301 etc etc

I'm really brain battered on this one and none of my trials work! Pleeeease heeeelp :confused:
 
Use the ampersand (&) to concatenate instead of a plus sign (+) because if you use plus signs it can give you unwanted results, especially when attempting to use with numbers because the plus sign means to add numbers, not concatenate them.

So, if you get in the habit of always using ampersands for concatenation, you shouldn't have a problem with your concatenations.
 
When I do things like this I always force the numbers to more digits than you'll ever need to make sure your quote reference is unique. ie use 0130 and 0003 to create quote reference 01300003. Otherwise quote 3 for company 131 is the same as quote 13 for company 13 etc. :eek:
 

Users who are viewing this thread

Back
Top Bottom