I am develioping library system using Visual Basic6 and SQL sever 2000. IN this system while adding new BOOk entry i want BOOKID should be like "BXXXX" (e.g. for first record it should be "B0001". I have designed the table for book where my BookID field is of Integer type.
I have created following function (LOADBOOKID) to increment the BOOKID.But my problem is it is not incrementing what is the problem, it is giving type conversion error and it is not incrementing what is wrong in the code
New Book Entry
1. Private Sub LOADBOOKID()
2. Dim SR as Integer
3. DIM SRPLUS as String
4. Dim RSC As New RecordSet
5. RSC.Open “SELECT * FROM BOOKDETAILS”, Connect, adOpenStatic, adLockOptimistic, adCmdText
6. SR=RSC!BookID
7. SRPLUS=SR+18. Txtbookid.Text= “B”&Format(SRPLUS,”0000”)
9. RSC.Close
End Sub
Private Sub Form_Load()LOADBOOKIDEnd sub Private Sub Command1_click()LOADBOOKIDDim RSCAs New Recordset RSCAs.open “SELECT * FROM BOOKDETAILS”, Connect, adOpenStatic, adLockOptimistic, adCmdText
.............
.........
.......
.......
end sub
Please help what is the problem..
Enter your message below
Sign in or Join us (it's free).