S
SimonW
Hi
I want to pass a number to a function that is used to refer to the field
collection of a recordset.
Function Next_Custom_Counter(n As Integer) 'number being passed is 0,
representing the 1st field in the recordset
Dim rs As ADODB.Recordset
Dim NextCounter As Long
Set rs = New ADODB.Recordset
'Open the ADO recordset.
rs.Open "custom", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
'Get the next counter.
NextCounter = rs.Fields(n)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Open table and get the current value of NextAvailableNumber,
'increment the value by 10, and save the value back into the table
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rs.Fields(n) = NextCounter + 1
NextCounter = rs.Fields(n)
....
....
I have tried numerous ways to acheive this but keep getting errors messages.
"Error 3219: Operation is not allowed in this context"
My only documentation is DAO, and I want to avoid using that. Can anyone
tell me what I'm doing wrong TIA, Simon
I want to pass a number to a function that is used to refer to the field
collection of a recordset.
Function Next_Custom_Counter(n As Integer) 'number being passed is 0,
representing the 1st field in the recordset
Dim rs As ADODB.Recordset
Dim NextCounter As Long
Set rs = New ADODB.Recordset
'Open the ADO recordset.
rs.Open "custom", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
'Get the next counter.
NextCounter = rs.Fields(n)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Open table and get the current value of NextAvailableNumber,
'increment the value by 10, and save the value back into the table
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rs.Fields(n) = NextCounter + 1
NextCounter = rs.Fields(n)
....
....
I have tried numerous ways to acheive this but keep getting errors messages.
"Error 3219: Operation is not allowed in this context"
My only documentation is DAO, and I want to avoid using that. Can anyone
tell me what I'm doing wrong TIA, Simon