Hay all,
for first soultion from sotoasty & JP may be easier but why i need to make refresh while i get the invoicenumber from the function and in next line i save it to database.
Iand i cant make these field auto increment becuase i have different type of invoices in same table like purchase ,return,..etc and each type has its own number .
I think about something i dont know if its possible or not if make addition field called status and when i save a new invoice i but status value=1 then we have stored procedure when he get new row he check status value if its 1 he create new invoice number ,If status value not equal 1 then do nothing.
and after that i return the value of invoiceno to visual basic .

May be these stubit idea but thats what in my small head now?