Can't understand this error - File not found

G

Guest

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
 
O

OfficeDev18 via AccessMonster.com

Biggles,

Your FROM clause is missing the Join.

FROM tblFUTURE_AUDITS, " & _
"tblFUTURE_AUDITS.txtTARGET_QTR "

should be

FROM tblFUTURE_AUDITS, " & _
"INNER JOIN tblFUTURE_AUDITS On ..."

Sam
Try
dim db as DAO.Database
Dim rst as DAO.Recordset

UpRider
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
[quoted text clipped - 85 lines]
 
G

Guest

Thank you both for your help. I fixed the From clause and the DAO. Not sure
if it was the combo or what, but it works now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top