Grrrrrumpy
Programmer
Here's the code I was given for Access 2000 to:
Sort a membership file by Lastname, Firstname & Suffix --
Spin thru the file and renumber the Membership number --
Sub Renumber_Members()
Dim MemberNumber as Long
Dim rstMEMBERS As New ADODB.Recordset
Dim strSQL As String
Dim cn1 As New ADODB.Recordset
Set cn1 = CurrentProject.Connection
strSQL = "SELECT LastName, Firstname, Suffix, MemNum "
strSQL = strSQL & "From tblMEMBERS "
strSQL = strSQL & "ORDER BY LastName, FirstName, Suffix;"
rstMEMBERS.Open strSQL, cn1, adOpenKeyset, adLockOptimistic
If rstMEMBERS.EOF = True then Exit Sub
MemberNumber = 1
Do Until rstMEMBERS.EOF = True
rstMEMBERS!MemNum = MemberNumber
rstMEMBERS.Update
rstMEMBERS.MoveNext
MemberNumber = MemberNumber + 1
Loop
rstMEMBERS.Close
Set cn1 = Nothing
End Sub
===========================
I'm getting the following error message --
Run-time error '-2147217865(80040e37)':
The Microsoft Jet database engine cannot find the input table or query 'tblMEMBERS'. Make sure that it exists and that the name is spelled correctly.
The table named MEMBERS does exist.
Am I missing a Dim statement?
(I'm not familiar with Access... this would be soooo
easy in DBase/Clipper/Foxpro)
Can anyone help me?
Sort a membership file by Lastname, Firstname & Suffix --
Spin thru the file and renumber the Membership number --
Sub Renumber_Members()
Dim MemberNumber as Long
Dim rstMEMBERS As New ADODB.Recordset
Dim strSQL As String
Dim cn1 As New ADODB.Recordset
Set cn1 = CurrentProject.Connection
strSQL = "SELECT LastName, Firstname, Suffix, MemNum "
strSQL = strSQL & "From tblMEMBERS "
strSQL = strSQL & "ORDER BY LastName, FirstName, Suffix;"
rstMEMBERS.Open strSQL, cn1, adOpenKeyset, adLockOptimistic
If rstMEMBERS.EOF = True then Exit Sub
MemberNumber = 1
Do Until rstMEMBERS.EOF = True
rstMEMBERS!MemNum = MemberNumber
rstMEMBERS.Update
rstMEMBERS.MoveNext
MemberNumber = MemberNumber + 1
Loop
rstMEMBERS.Close
Set cn1 = Nothing
End Sub
===========================
I'm getting the following error message --
Run-time error '-2147217865(80040e37)':
The Microsoft Jet database engine cannot find the input table or query 'tblMEMBERS'. Make sure that it exists and that the name is spelled correctly.
The table named MEMBERS does exist.
Am I missing a Dim statement?
(I'm not familiar with Access... this would be soooo
easy in DBase/Clipper/Foxpro)
Can anyone help me?