cesarelias
New member
- Local time
- Today, 15:22
- Joined
- May 10, 2009
- Messages
- 8
Hello,
I have the bellow code, I need put in the table the missing lngNumber.
How I do that?
Tabdados = table
cód = ID
I want to query about the record missing.
thanks
cesar
Public Sub MissingNumbers()
Dim rst As DAO.Recordset
Dim DB As DAO.Database
Dim strTable As String
Dim lngNumber As Long
Set DB = CurrentDb()
strTable = "SELECT cód FROM tabdados ORDER BY cód"
Set rst = DB.OpenRecordset(strTable)
rst.MoveFirst
lngNumber = rst.Fields("cód")
Do While Not rst.EOF
If rst.Fields("cód") = lngNumber Then
' the number is in sequence
rst.MoveNext
Else
' the number is not in sequence
Debug.Print lngNumber & " is missing"
End If
lngNumber = lngNumber + 1
Loop
DB.Close
'rst.Close
Set DB = Nothing
Set rst = Nothing
End Sub
I have the bellow code, I need put in the table the missing lngNumber.
How I do that?
Tabdados = table
cód = ID
I want to query about the record missing.
thanks
cesar
Public Sub MissingNumbers()
Dim rst As DAO.Recordset
Dim DB As DAO.Database
Dim strTable As String
Dim lngNumber As Long
Set DB = CurrentDb()
strTable = "SELECT cód FROM tabdados ORDER BY cód"
Set rst = DB.OpenRecordset(strTable)
rst.MoveFirst
lngNumber = rst.Fields("cód")
Do While Not rst.EOF
If rst.Fields("cód") = lngNumber Then
' the number is in sequence
rst.MoveNext
Else
' the number is not in sequence
Debug.Print lngNumber & " is missing"
End If
lngNumber = lngNumber + 1
Loop
DB.Close
'rst.Close
Set DB = Nothing
Set rst = Nothing
End Sub