I am able to read all the data from my table, but during the RunSQL part the insert into statment is not working for me for the Path field. When I am in debug mode I am able to view the data that is in path, but I still don't understand why the code does not insert into. Below is my code if that helps.
Private Sub Command4_Click()
Dim DBS As Database
Dim RST As Recordset
Dim Path As String
Dim Book As Single
Dim FirstDoc As Single
Dim LastDoc As Single
Dim I As Single
Dim INTableName As String
Dim OutTableName As String
INTableName = "Condo"
OutTableName = "Condo_Path"
Set DBS = CurrentDb
Set RST = DBS.OpenRecordset(INTableName)
If RST.BOF = False Then RST.MoveFirst
While RST.EOF = False
Path = Left(RST.Fields("Path").Value, 38)
Book = Left(RST.Fields("Book").Value, 4)
FirstDoc = Right(RST.Fields("FirstDoc").Value, 4)
If IsNull(RST.Fields("LastDoc").Value) = False Then
LastDoc = Right(RST.Fields("LastDoc").Value, 4)
DoCmd.SetWarnings False
For I = FirstDoc To LastDoc
DoCmd.RunSQL ("Insert Into " & OutTableName & " (Path, Book, Start) Values (" & Path & "," & Book & "," & I & ")")
Next I
Else
DoCmd.RunSQL ("Insert Into " & OutTableName & "(Path, Book, Start) VALUES (" & Path & "," & Book & "," & Right(RST.Fields("Start").Value, 5) & ")")
End If
RST.MoveNext
I = 0
Wend
DoCmd.SetWarnings True