I'm trying to read one recordset and write it to two other recordsets. The problem in the following code is it will fill the variables for ISA, GS and ST and setting breakpoints I see it finds AK2, IK3, IK4 and CTX but the variables never get set (e.g. xAK2Set = !Fileld01 will be empty.
Why does it work for Case "ISA" - xProd = !field15 but not Case "AK2" xAK2Set = !Fileld01?
Code:
Dim db As Database
Dim rstIN, rstHeader, rstIK5, rstAK9, rstSeg As Recordset
Dim tableName, theFileAndPath As String
Dim xProd, xDate, xTime, xSTID, xAK2Set, xAK2Ctl, xIK3Seg As String
Dim xIK3Pos, xIK3Loop, xIK3Err, xIK4Pos, xIK4Ref, xIK4Err, xIK4Date, xCTXErr As String
Set db = CurrentDb()
Set rstIN = db.OpenRecordset("tbl_999")
Set rstHeader = db.OpenRecordset("tbl_999_010_Header")
Set rstSeg = db.OpenRecordset("tbl_999_020_ErrSegments")
lineCount = 0
linesWritten = 0
With rstIN
.MoveFirst
Do While Not .EOF
Select Case !field00
Case "ISA"
xProd = !field15
Case "GS"
xDate = !Field04
xTime = !field05
rstHeader.AddNew
rstHeader.FileName = theFileName
rstHeader.FileDate = Mid(xDate, 5, 2) & "/" & Right(xDate, 2) & "/" & Left(xDate, 4)
rstHeader.FileTime = Left(xTime, 2) & ":" & Right(xTime, 2)
rstHeader.ProdTest = xProd
rstHeader.Update
Case "ST"
xSTID = !Field02
Case "AK2"
xAK2Set = !Fileld01
xAK2Ctl = Left(!Field02, (Len(!Fileld02) - 1))
Case "IK3"
xIK3Seg = !Fileld01
xIK3Pos = !Fileld02
xIK3Loop = !Fileld03
xIK3Err = Left(!Field04, (Len(!Fileld04) - 1))
Case "IK4"
xIK4Pos = !Fileld01
xIK4Ref = !Fileld02
xIK4Err = !Fileld03
xIK4Date = Left(!Field04, (Len(!Fileld04) - 1))
etc...
End Select
.MoveNext
Loop