You are here:

Visual Basic/vb6 Autogenerated Code


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.

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.



Visual Basic

All Answers

Answers by Expert:

Ask Experts


Amal Raj A


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


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

Brainbench Certification in VB 6.0

©2016 All rights reserved.