You are here:

Visual Basic/vb6 Autogenerated Code

Advertisement


Question
Sir,
I want to create an auto generated code against.some station name, like when I write Sealdah, the code will be 0001, but when I write Howrah,the code will be 0001 and the code of Sealdah will be 0002, after that when I entered Kharagpur, the code will change and it will stand Kharagpur-->0001; Howrah-->0002 and Sealdah-->0003, in this way the code will continue change i.r.o.the name of Stations.

Please sir guide me. If you help me I can solve my problems.

Thanking you.

Answer
Hi Pradip,

You need to store the code in a table of a Database. The table should contain the StationCode, StationName,etc. Everytime you want to create a new code, you need to query(using sql) for the table for highest value of the StationCode , store that in a variable, add 1 to the value of the variable and then use that as the new StationCode.

Regards,

Amal

Visual Basic

All Answers


Answers by Expert:


Ask Experts

Volunteer


Amal Raj A

Expertise

Can answer basic VB questions those are related to commonly used controls, VB/Access related questions, basic Flexgrid solutions

Experience

I have working with VB-Oracle/Dbase/Access for the past 4 years.

Education/Credentials
Brainbench Certification in VB 6.0

©2016 About.com. All rights reserved.