Function TextImport(Response As Integer, sFile As String)
On Error GoTo Err_Execute
Dim cncurrent As ADODB.Connection
Dim rsDiag As ADODB.Recordset
Dim strFileName As String
Dim strVersion As String
Dim strLocalhost As String
Dim strRemotehost As String
Dim strUuid As String
Dim strIPAddress As String
Dim strMACAddress As String
Dim strOS As String
Dim strAdmin As String
Dim strOrg As String
Dim dteDateTime As Date
Dim strWheelCount As String
Dim strLogs As String
Dim strUserGroup As String
Dim strShared As String
Dim strAV As String
Dim strIAVA As String
Dim strPwdPolicy As String
Dim strEnableLog As String
Dim lngMaxID As Long
Dim one, two, three, four, five, six, seven, eight, nine, ten As String
Dim eleven, twelve, thirteen, fourteen, fifteen, sixteen As String
'Import Text File
Set cncurrent = CurrentProject.Connection
Set rsDiag = New ADODB.Recordset
'Open the table to insert the text file into
strFileName = Mid$(sFile, InStrRev(sFile, "\") + 1)
strSQL = "Select * from Tbl_INFOCON_INFO"
rsDiag.Open strSQL, cncurrent, adOpenDynamic, adLockOptimistic
Do While Not EOF(1)
' Read a line of data.
Line Input #1, LineData
'Parse the line to allow grabbing the first value
one = Trim(Mid(LineData, InStr(LineData, ",") + 1))
two = Trim(Mid(one, InStr(one, ",") + 1))
three = Trim(Mid(two, InStr(two, ",") + 1))
four = Trim(Mid(three, InStr(three, ",") + 1))
five = Trim(Mid(four, InStr(four, ",") + 1))
six = Trim(Mid(five, InStr(five, ",") + 1))
seven = Trim(Mid(six, InStr(six, ",") + 1))
eight = Trim(Mid(seven, InStr(seven, ",") + 1))
nine = Trim(Mid(eight, InStr(eight, ",") + 1))
ten = Trim(Mid(nine, InStr(nine, ",") + 1))
eleven = Trim(Mid(ten, InStr(ten, ",") + 1))
twelve = Trim(Mid(eleven, InStr(eleven, ",") + 1))
thirteen = Trim(Mid(twelve, InStr(twelve, ",") + 1))
fourteen = Trim(Mid(thirteen, InStr(thirteen, ",") + 1))
fifteen = Trim(Mid(fourteen, InStr(fourteen, ",") + 1))
sixteen = Trim(Mid(fifteen, InStr(fifteen, ",") + 1))
strVersion = Trim(Left(LineData, InStr(LineData, ",") - 1))
strLocalhost = Trim(Left(one, InStr(one, ",") - 1))
strRemotehost = Trim(Left(two, InStr(two, ",") - 1))
strUuid = Trim(Left(three, InStr(three, ",") - 1))
strIPAddress = Trim(Left(four, InStr(four, ",") - 1))
strMACAddress = Trim(Left(five, InStr(five, ",") - 1))
strOS = Trim(Left(six, InStr(six, ",") - 1))
strAdmin = Trim(Left(seven, InStr(seven, ",") - 1))
strOrg = Trim(Left(eight, InStr(eight, ",") - 1))
dteDateTime = Trim(Left(nine, InStr(nine, ",") - 1))
strWheelCount = Trim(Left(ten, InStr(ten, ",") - 1))
strLogs = Trim(Left(eleven, InStr(eleven, ",") - 1))
strUserGroup = Trim(Left(twelve, InStr(twelve, ",") - 1))
strShared = Trim(Left(thirteen, InStr(thirteen, ",") - 1))
strAV = Trim(Left(fourteen, InStr(fourteen, ",") - 1))
strIAVA = Trim(Left(fifteen, InStr(fifteen, ",") - 1))
strPwdPolicy = Trim(Left(sixteen, InStr(sixteen, ",") - 1))
strEnableLog = Trim(Mid(sixteen, InStr(sixteen, ",") + 1))
rsDiag.AddNew
rsDiag!VERSIONINFO = strVersion
rsDiag!LOCALHOST = strLocalhost
rsDiag!Remotehost = strRemotehost
rsDiag!UUID = strUuid
rsDiag!IPADDRESS = strIPAddress
rsDiag!MACADDRESS = strMACAddress
rsDiag!OS = strOS
rsDiag!ADMINID = strAdmin
rsDiag!ORGNAME = strOrg
rsDiag!TIMESTAMP = dteDateTime
rsDiag!WHEELCOUNT = strWheelCount
rsDiag!LOGS = strLogs
rsDiag!USERSGROUPS = strUserGroup
rsDiag!SHARED = strShared
rsDiag!AV = strAV
rsDiag!IAVA = strIAVA
rsDiag!PASSWORDPOLICY = strPwdPolicy
rsDiag!ENABLEDLOGGING = strEnableLog
rsDiag!FileName = strFileName
rsDiag.Update
Loop
' Close the data file.
Close #1
rsDiag.Close
Response = 1
Exit Function
Err_Execute:
Select Case Err.Number
Case 3376
Resume Next
Case Else
MsgBox "TextImport " & Err.Number & ": " & Err.Description & " with: " & sFile
Response = 2
Close #1
Exit Function
End Select
End Function