Hi
I A Working On Vb As Front End And Sqlplus As Back End. I Want That Wehn I Enter A New Record In A Database Through Vb, The Form Number Field Automatically Increments Itself By 1.
u may try it in vb as
-
-
dim newId&
-
newId=GenrateNewId(<Column name>,<tableName>)
-
-
private function GenrateNewId(sColName$,sTblName$)as long
-
dim ssql$
-
dim Rs0 as new Adodb.Recordset
-
dim Conn as new Adodb.Connection
-
Conn.open <Connstr>
-
ssql="select nvl(max(" & sColName & "),0)+1 from " & sTblName
-
Rs0.open ssql,Conn
-
genratenewid=rs0(0)
-
rs0.close:set rs0=nothing
-
Conn.close
-
end sub
-
This code is not written using vb editor so pls check errors
or u may use Trigger for that