![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a table which has employee number. I have attempted to creat a function whic will derive a unique number for each record how ever the code below only returns 10,000 for all records. What I am doing wrong? I am I right in saying that In assuming that I dont to loop since I am returnign this for a every record in query. Your help will be greatly appreciated. Function Generate_Number(emp_no As Variant) As Variant Dim strSQL As Variant Dim rst As Recordset Dim Counter As Variant counter = 10000 strSQL = "Select emp_no From AA_SAP_Numbers Order By emp_no" 'open the results Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot) rst.MoveFirst Counter = counter + 1 rst.MoveNext rst.Close Generate_Number = Counter End Function Andy |
#3
| |||
| |||
|
|
I have a table which has employee number. I have attempted to creat a function whic will derive a unique number for each record how ever the code below only returns 10,000 for all records. What I am doing wrong? I am I right in saying that In assuming that I dont to loop since I am returnign this for a every record in query. Your help will be greatly appreciated. Function Generate_Number(emp_no As Variant) As Variant Dim strSQL As Variant Dim rst As Recordset Dim Counter As Variant counter = 10000 strSQL = "Select emp_no From AA_SAP_Numbers Order By emp_no" 'open the results Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot) rst.MoveFirst Counter = counter + 1 rst.MoveNext rst.Close Generate_Number = Counter End Function Andy |
![]() |
| Thread Tools | |
| Display Modes | |
| |