I have a module and a table that I am trying to use to advance a number by 1
Module is named ModEvenIDCounter and table is named EventCounterTable
table EventCounterTable has one field named NextCustomerEventIDCounter which is a primary key
It is Long Integer and set to no duplicates
I think my code on the module is off because when I try and increment a value into my field, all it does is add a 0
The number in the field nextCustomEventIDCounter is 999 right now
I am missing something simple I'm sure. Here is the code for the module.
Function Next_CustomEventID_Counter()
On Error GoTo Next_Custom_Counter_Err
Dim rs As ADODB.Recordset
Dim NextCounter As Long
Set rs = New ADODB.Recordset
rs.Open "EventCounterTable", CurrentProject.Connection, adOpenKeyset, adLockOptimistic 'Open the ADO recordset.
NextCounter = rs!NextCustomEventIDCounter 'Get the next counter.
rs!NextEventIDCounter = NextCounter + 1
NextCounter = rs!NextEventIDCounter
rs.Update
'MsgBox "Next available counter value is " & Str(NextCounter)
rs.Close
Set rs = Nothing