WyldeCarde
MIS
In this snippet of my code:
I am getting a file not found error on the last line.
I don't really get it, the recordset name is correct as is the field name, in fact I copied and pasted the lines from another piece of script, just changing the names of the field and variables.
I'm hoping I'm just going slightly blind and have made a silly typo. I work in a department by myself however so I can't get someone to cast their eyes over it.
The entirety of the code follows but I'm sure it must be the first bit that's at fault.
Code:
Function Filter_Proc2()
Dim isFound, TextLine1
Dim rst_read As Recordset
Dim rst_write As Recordset
Dim dbs As Database
Set dbs = CurrentDb
Set rstread = dbs.OpenRecordset("Stored_Proc")
Set rstwrite = dbs.OpenRecordset("Filter_Proc")
rstread.MoveFirst
While Not rstread.EOF
Open rstread.Function_name For Input As #1
I am getting a file not found error on the last line.
I don't really get it, the recordset name is correct as is the field name, in fact I copied and pasted the lines from another piece of script, just changing the names of the field and variables.
I'm hoping I'm just going slightly blind and have made a silly typo. I work in a department by myself however so I can't get someone to cast their eyes over it.
The entirety of the code follows but I'm sure it must be the first bit that's at fault.
Code:
Option Compare Database
Function Filter_Proc2()
Dim isFound, TextLine1
Dim rst_read As Recordset
Dim rst_write As Recordset
Dim dbs As Database
Set dbs = CurrentDb
Set rstread = dbs.OpenRecordset("Stored_Proc")
Set rstwrite = dbs.OpenRecordset("Filter_Proc")
rstread.MoveFirst
While Not rstread.EOF
Open rstread.Function_name For Input As #1
Do While Not EOF(1)
Line Input #1, TextLine1
isFound = InStr(1, TextLine1, "Exec", 1)
'If found go to the output process
If isFound > 0 Then GoTo found2
'If not found go to the end of the loop
GoTo Done_all2
found2:
Debug.Print "Searching Procedure - "; rstread!Function_name
varReturn = SysCmd(acSysCmdSetStatus, "Searching Procedure - " & rstread!Function_name)
I = InStr(TextLine1, "Exec")
'If not found go to end
If I = 0 Then GoTo Done_all2
raw_name = TextLine1
'If found, crop the data outside of the quotes
'raw_start = Mid(TextLine1, I + 1)
'I = InStr(raw_start, Chr(34))
'If I = 0 Then GoTo Done_all2
'raw_name = Mid(raw_start, 1, I - 1)
'Write found data to "Stored_proc" table
rstwrite.AddNew
rstwrite!Source_Proc = rstread!Function_name
Debug.Print "Found Stored Procedure - "; raw_name
varReturn = SysCmd(acSysCmdSetStatus, "Found Stored Procedure - " & raw_name)
rstwrite!Function_name = raw_name
rstwrite.Update
Done_all2:
Loop
'Close recordset
Close #1
' Move to next path in the "File_Paths" table
rstread.MoveNext
'Forms!Progress.Refresh
'OpenForms = DoEvents
Wend
End Function