This code will generate auto id number for the unique id.
Public Sub id()
Dim lastnumber As Long, newnumber As Long
'Check if there are records in the file
With recordset
If .BOF = True And .EOF = True Then
lastnumber = (any number)
Else
.MoveLast
lastnumber = !field in recordset
End If
'Generate New Number
newnumber = lastnumber + 1
Text1.Text = newnumber
End With
End Sub
please comment if this post helps you.....
You can search item through this code on keypress in datagrid, Like if you press 1 in textbox then all record starts from 1***** will be displayed, without hitting any other button. Private Sub text_change() With recordset If .State adStateClosed Then .Close End If .Open "select * from table where empid like'" & Text1.Text & "%'", con, adOpenDynamic, adLockOptimistic Set DataGrid1.DataSource = recordset End With End Sub comment if this code helps u
Thank you very much for the code.......It was very helpfully
ReplyDeleteSir yea code kasy work krta hye?please help me
Deletewhere will i put those codes sir ? in general for Dim lastnumber As Long, newnumber As Long ?
ReplyDeleteplease share vb6.0 & db file that generate auto ID number....I face error
Delete& I REALLY WANT AUTO NUMBER IN MY PROJECT
please help
or create a sub procedure ? for what
ReplyDeleteWorks Well... ^_^
ReplyDeleteplease share vb6.0 & db file that generate auto ID number....I face error
Delete& I REALLY WANT AUTO NUMBER IN MY PROJECT
where to put this code ..kindly help me
please share vb6.0 & db file that generate auto ID number....I face error
ReplyDelete& I REALLY WANT AUTO NUMBER IN MY PROJECT
Any one can help where to put this code
ReplyDelete