Hi
i want set autoincremwnt in product code . how to code using access. pls mail me
nagarajan
Printable View
Hi
i want set autoincremwnt in product code . how to code using access. pls mail me
nagarajan
When you design your access table, set the Fields data type to autonumber
Step wise Solution :Quote:
Originally posted by naga_nr
Hi
i want set autoincremwnt in product code . how to code using access. pls mail me
nagarajan
1. While opening recordset use the max property with the field to retrieve the maximum value record. for ex:
rs.Open "Select max(ProdCode) from Product", cn, adOpenKeyset, adLockOptimistic
txtCode.Text = rs(0).Value
2. On Button Click write this code :
Dim iPos As Integer
Dim iCnt As Integer
iPos = InStr(1, txtCode.Text, "R")
iCnt = Mid(txtCode.Text, iPos + 1)
iCnt = iCnt + 1
txtCode.Text = "PR" & iCnt
On each click u will get increment in the value
Check if it works ,,
Bye
Ajit Rajput
[email protected]
Pune