I am using the following VBA to find missing numbers (formated as text) in a list of numbers being used to generate a table of unused numbers. The program runs without flaw from first message to last. However, nothing is being copied over to the new table.
The program is as follows
Private Sub Form_Open(Cancel As Integer)
MsgBox "Checking for Unused Postions."
'ID Variables
Dim RS650 As DAO.Recordset
Dim RSMis As DAO.Recordset
Dim Count As Integer
Dim Main As String
'Set Recordset
Set RS650 = CurrentDb.OpenRecordset("qryStationsUsed_650")
Set RSMis = CurrentDb.OpenRecordset("tblStationsMissing")
'Find Missing Numbers
Count = 1
RS650.MoveFirst
Main = RS650("650")
Do While RS650.EOF = False
If Main <> Count Then
RSMis.AddNew
'
'THIS IS WHERE THE DATA SHOULD BE COPIED
'
RSMis("650") = Count
'
'
RSMis.Update
RS650.MovePrevious
End If
RS650.MoveNext
Main = RS650("650")
Loop
MsgBox "Finished Checking for Unused Positions."
End Sub
Does it matter that RSMis("650") is a text field and
Count is a Integer?
Thanks for your time and help with this problem
Robert M
The program is as follows
Private Sub Form_Open(Cancel As Integer)
MsgBox "Checking for Unused Postions."
'ID Variables
Dim RS650 As DAO.Recordset
Dim RSMis As DAO.Recordset
Dim Count As Integer
Dim Main As String
'Set Recordset
Set RS650 = CurrentDb.OpenRecordset("qryStationsUsed_650")
Set RSMis = CurrentDb.OpenRecordset("tblStationsMissing")
'Find Missing Numbers
Count = 1
RS650.MoveFirst
Main = RS650("650")
Do While RS650.EOF = False
If Main <> Count Then
RSMis.AddNew
'
'THIS IS WHERE THE DATA SHOULD BE COPIED
'
RSMis("650") = Count
'
'
RSMis.Update
RS650.MovePrevious
End If
RS650.MoveNext
Main = RS650("650")
Loop
MsgBox "Finished Checking for Unused Positions."
End Sub
Does it matter that RSMis("650") is a text field and
Count is a Integer?
Thanks for your time and help with this problem
Robert M