|
-
Dec 4th, 2000, 12:51 AM
#1
Thread Starter
New Member
Hi
i want set autoincremwnt in product code . how to code using access. pls mail me
nagarajan
-
Dec 4th, 2000, 01:07 AM
#2
PowerPoster
.
When you design your access table, set the Fields data type to autonumber
-
Dec 4th, 2000, 01:50 AM
#3
Solution for AutoIncrement
Originally posted by naga_nr
Hi
i want set autoincremwnt in product code . how to code using access. pls mail me
nagarajan
Step wise Solution :
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|