G
Guest
Hi,
I have written some code that I want to step through. From my limited
knowledge of Access there is no other way of running this code without using
a button (on click) to kick it off.
The reason I want to do this is to get the following code to run.
Private Sub LoadFile(sDir_and_Path As String)
On Error GoTo Macro1_Err
DoCmd.TransferText acImportDelim, "PO_Spec", "Tbl_PO_Listing",
sDir_and_Path
Macro1_Exit:
Exit Sub
Macro1_Err:
MsgBox sFile & ": " & Error$
Resume Macro1_Exit
End Sub
Public Sub I_LoadFiles(sDir_and_Path As String)
Dim dbsStatus As Database
Dim rstFiles As Recordset
Dim StrReq As String
Dim dTDate As Date
DoCmd.SetWarnings False
Set dbsStatus = CurrentDb
StrReq = "SELECT * FROM Tbl_Filenames"
Set rstFiles = dbsStatus.OpenRecordset(StrReq)
With rstFiles
Do While Not .EOF
If !File.Import = True Then
Call LoadFile(sDir_and_Path)
End If
.MoveNext
Loop
.Close
End With
dbsStatus.Close
DoCmd.SetWarnings True
End Sub
I didn't write the code but I'm pretty sure I can degug itonce it gets going
but I can't get the module to start. I've tried to create a button with an
on-click procedure and then for that procedure to call LoadFiles but I get
the following error.
The expression on-click you entered as the event propert setting produced
the following error: Procedure declaration does not match description of
event or procedure having the same name.
Is there an easy way to simply point the button to the LoadFiles code?
I'm expecting the code will look at a list of files in a table
(Tbl_Filenames) and import the contents into another table 'Tbl_PO_Listing'.
I have written some code that I want to step through. From my limited
knowledge of Access there is no other way of running this code without using
a button (on click) to kick it off.
The reason I want to do this is to get the following code to run.
Private Sub LoadFile(sDir_and_Path As String)
On Error GoTo Macro1_Err
DoCmd.TransferText acImportDelim, "PO_Spec", "Tbl_PO_Listing",
sDir_and_Path
Macro1_Exit:
Exit Sub
Macro1_Err:
MsgBox sFile & ": " & Error$
Resume Macro1_Exit
End Sub
Public Sub I_LoadFiles(sDir_and_Path As String)
Dim dbsStatus As Database
Dim rstFiles As Recordset
Dim StrReq As String
Dim dTDate As Date
DoCmd.SetWarnings False
Set dbsStatus = CurrentDb
StrReq = "SELECT * FROM Tbl_Filenames"
Set rstFiles = dbsStatus.OpenRecordset(StrReq)
With rstFiles
Do While Not .EOF
If !File.Import = True Then
Call LoadFile(sDir_and_Path)
End If
.MoveNext
Loop
.Close
End With
dbsStatus.Close
DoCmd.SetWarnings True
End Sub
I didn't write the code but I'm pretty sure I can degug itonce it gets going
but I can't get the module to start. I've tried to create a button with an
on-click procedure and then for that procedure to call LoadFiles but I get
the following error.
The expression on-click you entered as the event propert setting produced
the following error: Procedure declaration does not match description of
event or procedure having the same name.
Is there an easy way to simply point the button to the LoadFiles code?
I'm expecting the code will look at a list of files in a table
(Tbl_Filenames) and import the contents into another table 'Tbl_PO_Listing'.