D
Darren
I'm trying to get the code from the KB article #210194 to
work. Creating a Custom Counter.
http://support.microsoft.com/default.aspx?scid=kb;en-us;210194
As far as I can tell my code and actions are identical to
the article. However when I click on the form I get an
Error: 3265 msg. This error appears to be due to an object
being referenced before it is in the library? (link -
http://support.microsoft.com/default.aspx?scid=kb;en-us;223212)
Here is my code which compiles fine:
Function Next_Custom_Counter()
On Error GoTo Next_Custom_Counter_Err
Dim rs As ADODB.Recordset
Dim NextCounter As Long
Set rs = New ADODB.Recordset
rs.Open "CounterTable", CurrentProject.Connection,
adOpenKeyset, adLockOptimistic
NextCounter = rs!NextAvailableCounter
rs!NextAvailableCounter = NextCounter + 10
NextCounter = rs!NextAvailableCounter
rs.Update
MsgBox "Next Available Counter is " & Str(NextCounter)
rs.Close
Set rs = Nothing
Next_Custom_Counter = NextCounter
Exit Function
Any suggestions?
work. Creating a Custom Counter.
http://support.microsoft.com/default.aspx?scid=kb;en-us;210194
As far as I can tell my code and actions are identical to
the article. However when I click on the form I get an
Error: 3265 msg. This error appears to be due to an object
being referenced before it is in the library? (link -
http://support.microsoft.com/default.aspx?scid=kb;en-us;223212)
Here is my code which compiles fine:
Function Next_Custom_Counter()
On Error GoTo Next_Custom_Counter_Err
Dim rs As ADODB.Recordset
Dim NextCounter As Long
Set rs = New ADODB.Recordset
rs.Open "CounterTable", CurrentProject.Connection,
adOpenKeyset, adLockOptimistic
NextCounter = rs!NextAvailableCounter
rs!NextAvailableCounter = NextCounter + 10
NextCounter = rs!NextAvailableCounter
rs.Update
MsgBox "Next Available Counter is " & Str(NextCounter)
rs.Close
Set rs = Nothing
Next_Custom_Counter = NextCounter
Exit Function
Any suggestions?