String

  • Thread starter Thread starter chris
  • Start date Start date
C

chris

HI

I want to compose a string of characters each time the
user enter a new product he sales.

So product will have the ID

ENG12-001
Where:
ENG is assign to the product name
12 is the Entreprise ID
001 is the number of the product that the user buy

SO if he sale same product for the same entreprise I'll
have ENG12-002

any help please
 
Chris,

I am assuming your getting the individual peices to the
string from a form where this information is entered. I am
also assuming you will generate this either after pressing
a command button or the afterupdate event for one or more
of the component fields. With those assumptions, use
something like the following:

dim codeStr as String
dim saleQty as integer

codeStr=Me![ProductCode]&Me![EnterpriseCode]&SaleQty

If I understand the last component of your striing, the
variable saleQty would probably need to be determined on
the fly at the time the record is entered using a
recordset query and adding 1 to the value. If you depend
on the user to provide this, at some point someone will
enter the wrong value. Also, to get the 001 type format,
you will have to format the value and I am not sure how to
do that off hand, but I know it can be done.

Post back if you need more help!

Hope that helps!

Kevin
 
Back
Top