@rpeare,
Nice bit of code.
However I was getting duplicate "RSH_Degree" values in the table and the degrees stopped at 119. I finally tracked it down to two aLine() values:
Your code
Code:
<snip>
Do Until InStr(sline, Chr(176)) = 0
sline = Replace(Replace(Replace(Replace(Replace(sline, Chr(176), ""), "m", ""), " ", " "), " ", " "), " ", " ")
aLine = Split(sline, " ")
'insert each radial value into the table tblRadioStationHAAT
sSQL = "INSERT INTO tblRadioStationHAAT (RS_ID,RSH_Degree,RSH_Height) VALUES ("
sSQL = sSQL & iRSID & ","
sSQL = sSQL & IIf(aLine(0) = "0", 360, aLine(0)) & ","
sSQL = sSQL & aLine(1) & ")"
CurrentDb.Execute sSQL
sSQL = "INSERT INTO tblRadioStationHAAT (RS_ID,RSH_Degree,RSH_Height) VALUES ("
sSQL = sSQL & iRSID & ","
sSQL = sSQL & IIf(aLine(2) = "0", 360, aLine(0)) & ","
sSQL = sSQL & aLine(3) & ")"
CurrentDb.Execute sSQL
sSQL = "INSERT INTO tblRadioStationHAAT (RS_ID,RSH_Degree,RSH_Height) VALUES ("
sSQL = sSQL & iRSID & ","
sSQL = sSQL & IIf(aLine(4) = "0", 360, aLine(0)) & ","
sSQL = sSQL & aLine(5) & ")"
CurrentDb.Execute sSQL
sline = Trim(f.readline)
<snip>
I changed it to :
Code:
<snip>
Do Until InStr(sline, Chr(176)) = 0
sline = Replace(Replace(Replace(Replace(Replace(sline, Chr(176), ""), "m", ""), " ", " "), " ", " "), " ", " ")
aLine = Split(sline, " ")
'insert each radial value into the table tblRadioStationHAAT
sSQL = "INSERT INTO tblRadioStationHAAT (RS_ID,RSH_Degree,RSH_Height) VALUES ("
sSQL = sSQL & iRSID & ","
sSQL = sSQL & IIf(aLine(0) = "0", 360, aLine(0)) & ","
sSQL = sSQL & aLine(1) & ")"
CurrentDb.Execute sSQL
sSQL = "INSERT INTO tblRadioStationHAAT (RS_ID,RSH_Degree,RSH_Height) VALUES ("
sSQL = sSQL & iRSID & ","
sSQL = sSQL & IIf(aLine(2) = "0", 360, aLine(2)) & "," '<<-- changed 0 to 2
sSQL = sSQL & aLine(3) & ")"
CurrentDb.Execute sSQL
sSQL = "INSERT INTO tblRadioStationHAAT (RS_ID,RSH_Degree,RSH_Height) VALUES ("
sSQL = sSQL & iRSID & ","
sSQL = sSQL & IIf(aLine(4) = "0", 360, aLine(4)) & "," '<<-- changed 0 to 4
sSQL = sSQL & aLine(5) & ")"
CurrentDb.Execute sSQL
sline = Trim(f.readline)
<snip>
No more duplicated "RSH_Degree" values.