Hi there, I am a newbie at access and attempting to import txt into access. I am currently working with a database that was built by another developer and am struggling to find how the import process that was previously built works.
The code behind the button:
Private Sub ImportOracle_Click()
Dim namefile As String
Dim nameInput As String
Dim lngAnswer As Long
On Error GoTo errHandler:
'when error is ahppeninig on the statement below then the program will jump to
' errHandler: lable which is located in the very bottom of this module
lngAnswer = MsgBox("Are you sure that data in Oracle.txt is updated?", vbYesNoCancel, "Append Record?")
Select Case lngAnswer
'if yes then import the file
Case vbYes
namefile = "R:\Quality Management\DailyError\Oracle.txt"
DoCmd.TransferText acImportDelim, "Oracle Raw Spec", "Oracle_Raw_Data_Table", namefile
DoCmd.OpenQuery "Oracle_Error_Daily_Import", acViewNormal, acReadOnly
DoCmd.Requery (Forms!DailyMenu!List13)
'if not then do nothing
Case vbNo, vbCancel
'do nothing
End Select
'set warning to true and get out from vba
DoCmd.SetWarnings True
Exit Sub
errHandler:
MsgBox "Import Failed", vbOKOnly
DoCmd.SetWarnings True
End Sub
I'm not sure where to begin in identifying where the problem lies.
Appreciate the help!