Douglas J. Steele said:
AFAIK, you cannot use IN (nor [[;Database=C:\Folder\File.mdb].Table,
which I prefer in SQL).
One option, of course, is to create a linked table in your database.
Another is to use Automation:
Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess.OpenCurrentDatabase " \\Backoffice\Warehouse\History.mdb "
Me.TxtSubFX = Nz(appAccess.DCount("ChkFXSep", "tblChecks", _
"ChkFXSep = -1 And ChkServer = " & Me.TxtServerID & _
"And ChkBizDay BETWEEN " & _
Format(Forms!frmReportDates!TxtStart, "\#yyyy\-mm\-dd\#") & " AND " &
_
Format(Forms!frmReportDates!TxtEnd, "\#yyyy\-mm\-dd\#"), 0)
appAccess.CloseCurrentDatabase
Set accAccess = Nothing
Wouldn't it be simpler to just open a recordset on the other database?
Along these lines:
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset( _
"SELECT Count(*) FROM " & _
"[MS Access;Database=\\Backoffice\Warehouse\History.mdb]" & _
".tblChecks " & _
"WHERE ChkFXSep = -1 And ChkServer = " & Me.TxtServerID & _
" And ChkBizDay BETWEEN " & _
Format(Forms!frmReportDates!TxtStart, "\#yyyy\-mm\-dd\#") & _
" AND " & _
Format(Forms!frmReportDates!TxtEnd, "\#yyyy\-mm\-dd\#"), _
dbOpenSnapshot)
Me.TxtSubFX = rs(0)
rs.Close