B
Biggles
When I try to run a section of VB code, I get an error that I don't
understand, since I am not asking it to look in another file. Here is the
error:
Could not find file "C:\....\tblFUTURE_AUDITS.MDB"
Of course that file does not exist since it is a table in the current
database.
Any idea as to what might be causing this? I am using MS ACCESS 2000 and MS
DAO 3.6 Object Library is checked.
This is the code used to call:
Private Sub btnENT_WEST_DIV_Click()
On Error GoTo Err_btnENT_WEST_DIV_Click
Dim AUDGRP As String
Dim AENO As Integer
AENO = Me![Text9]
AUDGRP = "7"
Call SELECT_SQL(AENO, AUDGRP)
Exit_btnENT_WEST_DIV_Click:
Exit Sub
Err_btnENT_WEST_DIV_Click:
MsgBox Err.Description
Resume Exit_btnENT_WEST_DIV_Click
End Sub
Private Sub SELECT_SQL(AENO As Integer, AUDGRP As String)
Dim db As Database
Dim rst As Recordset
Dim SSQL1 As String
Dim ITM As Variant
Dim Grp As Variant
SSQL1 = "SELECT tblFUTURE_AUDITS.txtAUDIT_ENTITY_NO,
tblFUTURE_AUDITS.txtAUDGRP, " & _
"tblFUTURE_AUDITS.txtYEAR,
tblFUTURE_AUDITS.intFULL_SCOPE_HRS, " & _
"tblFUTURE_AUDITS.intLTD_SCOPE_HRS,
tblFUTURE_AUDITS.intSOX_404_HRS, " & _
"tblFUTURE_AUDITS.intFULL_SCOPE_IT,
tblFUTURE_AUDITS.intLTD_SCOPE_IT, " & _
"tblFUTURE_AUDITS.intSOX_404_IT,
tblFUTURE_AUDITS.intCONTINUOUS_AUD_HRS, " & _
"tblFUTURE_AUDITS.intOTHER FROM tblFUTURE_AUDITS, " & _
"tblFUTURE_AUDITS.txtTARGET_QTR " & _
"WHERE [txtAUDIT_ENTITY_NO] = " & AENO & " AND TXTAUDGRP
= " & "'" & AUDGRP & "'"
Set db = CurrentDb()
Set rst = db.OpenRecordset(SSQL1)
rst.OpenRecordset
'MAKE THE BOXES AND LABELS VISIBLE AND SET THE FLAG, AND ENTER HOURS IF
THERE
For Each ITM In Array("_FULL_HRS", "_LTD_HRS", "_SOX_HRS", _
"_FULL_IT", "_LTD_IT", "_SOX_IT", "_CA_HRS", _
"_OTHER", "_TOTALS", "LABEL", "_TQTR")
For Each Grp In Array(AUDGRP)
Me(Grp & ITM).Visible = True
If rst.RecordCount = 0 Then
Me(Grp & "NEW") = 1
Else
Me(Grp & "NEW") = 2
Me(Grp & "_TQTR") = rst!txtTARGET_QTR
Me(Grp & "_FULL_HRS") = rst!intFULL_SCOPE_HRS
Me(Grp & "_LTD_HRS") = rst!intLTD_SCOPE_HRS
Me(Grp & "_SOX_HRS") = rst!intSOX_404_HRS
Me(Grp & "_FULL_IT") = rst!intFULL_SCOPE_IT
Me(Grp & "_LTD_IT") = rst!intLTD_SCOPE_IT
Me(Grp & "_SOX_IT") = rst!intSOX_404_IT
Me(Grp & "_CA_HRS") = rst!intCONTINUOUS_AUD_HRS
Me(Grp & "_OTHER") = rst!intOTHER
End If
Next Grp
Next ITM
End Sub
understand, since I am not asking it to look in another file. Here is the
error:
Could not find file "C:\....\tblFUTURE_AUDITS.MDB"
Of course that file does not exist since it is a table in the current
database.
Any idea as to what might be causing this? I am using MS ACCESS 2000 and MS
DAO 3.6 Object Library is checked.
This is the code used to call:
Private Sub btnENT_WEST_DIV_Click()
On Error GoTo Err_btnENT_WEST_DIV_Click
Dim AUDGRP As String
Dim AENO As Integer
AENO = Me![Text9]
AUDGRP = "7"
Call SELECT_SQL(AENO, AUDGRP)
Exit_btnENT_WEST_DIV_Click:
Exit Sub
Err_btnENT_WEST_DIV_Click:
MsgBox Err.Description
Resume Exit_btnENT_WEST_DIV_Click
End Sub
Private Sub SELECT_SQL(AENO As Integer, AUDGRP As String)
Dim db As Database
Dim rst As Recordset
Dim SSQL1 As String
Dim ITM As Variant
Dim Grp As Variant
SSQL1 = "SELECT tblFUTURE_AUDITS.txtAUDIT_ENTITY_NO,
tblFUTURE_AUDITS.txtAUDGRP, " & _
"tblFUTURE_AUDITS.txtYEAR,
tblFUTURE_AUDITS.intFULL_SCOPE_HRS, " & _
"tblFUTURE_AUDITS.intLTD_SCOPE_HRS,
tblFUTURE_AUDITS.intSOX_404_HRS, " & _
"tblFUTURE_AUDITS.intFULL_SCOPE_IT,
tblFUTURE_AUDITS.intLTD_SCOPE_IT, " & _
"tblFUTURE_AUDITS.intSOX_404_IT,
tblFUTURE_AUDITS.intCONTINUOUS_AUD_HRS, " & _
"tblFUTURE_AUDITS.intOTHER FROM tblFUTURE_AUDITS, " & _
"tblFUTURE_AUDITS.txtTARGET_QTR " & _
"WHERE [txtAUDIT_ENTITY_NO] = " & AENO & " AND TXTAUDGRP
= " & "'" & AUDGRP & "'"
Set db = CurrentDb()
Set rst = db.OpenRecordset(SSQL1)
rst.OpenRecordset
'MAKE THE BOXES AND LABELS VISIBLE AND SET THE FLAG, AND ENTER HOURS IF
THERE
For Each ITM In Array("_FULL_HRS", "_LTD_HRS", "_SOX_HRS", _
"_FULL_IT", "_LTD_IT", "_SOX_IT", "_CA_HRS", _
"_OTHER", "_TOTALS", "LABEL", "_TQTR")
For Each Grp In Array(AUDGRP)
Me(Grp & ITM).Visible = True
If rst.RecordCount = 0 Then
Me(Grp & "NEW") = 1
Else
Me(Grp & "NEW") = 2
Me(Grp & "_TQTR") = rst!txtTARGET_QTR
Me(Grp & "_FULL_HRS") = rst!intFULL_SCOPE_HRS
Me(Grp & "_LTD_HRS") = rst!intLTD_SCOPE_HRS
Me(Grp & "_SOX_HRS") = rst!intSOX_404_HRS
Me(Grp & "_FULL_IT") = rst!intFULL_SCOPE_IT
Me(Grp & "_LTD_IT") = rst!intLTD_SCOPE_IT
Me(Grp & "_SOX_IT") = rst!intSOX_404_IT
Me(Grp & "_CA_HRS") = rst!intCONTINUOUS_AUD_HRS
Me(Grp & "_OTHER") = rst!intOTHER
End If
Next Grp
Next ITM
End Sub