tamangspace
Registered User.
- Local time
- Tomorrow, 00:10
- Joined
- Jul 15, 2012
- Messages
- 37
Dear All,
I don't know how to express this problem. I am not expert in vba. just learning a bit. I got some code like this:
I created a module from this code. It seems like this:
I created a query and used this code. In the AutoNum field I typed like this: AutoNum: GetAutoNumber([EmpName])
It works first time when I open it. After 1 or 2 seconds it automatically updates and autonumber will be not starting from 1. Autonumber starts from like 180 or more. After another 3 - 5 seconds it increases and starts like 350 or more.
I want to start autonumber from just 1. I am sorry if I couldn't express my problem properly, but I am so frustrated because I want the list of employees with autonumber starting from 1.
Any help is most appreciated.
I don't know how to express this problem. I am not expert in vba. just learning a bit. I got some code like this:
Code:
Public wANum As Long
Function GetAutoNumber(EmpNAME) As Long
wANum = wANum + 1
GetAutoNumber = (wANum)
End Function
Code:
Option Compare Database
Option Explicit
Public wANum As Long
Function GetAutoNumber(EmpNAME) As Long
wANum = wANum + 1
GetAutoNumber = (wANum)
End Function
I created a query and used this code. In the AutoNum field I typed like this: AutoNum: GetAutoNumber([EmpName])
It works first time when I open it. After 1 or 2 seconds it automatically updates and autonumber will be not starting from 1. Autonumber starts from like 180 or more. After another 3 - 5 seconds it increases and starts like 350 or more.
I want to start autonumber from just 1. I am sorry if I couldn't express my problem properly, but I am so frustrated because I want the list of employees with autonumber starting from 1.
Any help is most appreciated.