K
Kan D.
1. I'm using the DCount function to access a value in a LINKED TABLE.
2. I have READ ONLY access to the database which the linked table is linked
to.
3. If the database that the table is linked to is currently open on another
machine, and when the line of code that uses the DCount function executes, I
get the following error message:
Run-time error '3045':
Could not use '\\myPath\myDatabase.mdb'; file already in use.
Does anybody know a way around this? Do I have to do the following to get a
Count of the records I specify in the criteria parameter of the DCount
function, or can somebody think of a better solution to solving Run-time
error '3045'?
-----
Dim db as Database, rs as Recordset
Dim myCounter as integer
Set db = CurentDb
Set rs = db.OpenRecordset ("SELECT * FROM MyTable WHERE MyField = '" &
myCriteria & "'")
With rs
If .RecordCount > 0 then
.MoveLast
.MoveFirst
Do Until .EOF
myCounter = myCounter + 1
.MoveNext
Loop
End If
End With
Set rs = Nothing
set db = Nothing
-----
Do I have to do the above code to get a Count of the records I specify in
the criteria parameter of the DCount function or can somebody think of a
better solution to solving Run-time error '3045'?
Please Help,
Thanks ---- Kan
2. I have READ ONLY access to the database which the linked table is linked
to.
3. If the database that the table is linked to is currently open on another
machine, and when the line of code that uses the DCount function executes, I
get the following error message:
Run-time error '3045':
Could not use '\\myPath\myDatabase.mdb'; file already in use.
Does anybody know a way around this? Do I have to do the following to get a
Count of the records I specify in the criteria parameter of the DCount
function, or can somebody think of a better solution to solving Run-time
error '3045'?
-----
Dim db as Database, rs as Recordset
Dim myCounter as integer
Set db = CurentDb
Set rs = db.OpenRecordset ("SELECT * FROM MyTable WHERE MyField = '" &
myCriteria & "'")
With rs
If .RecordCount > 0 then
.MoveLast
.MoveFirst
Do Until .EOF
myCounter = myCounter + 1
.MoveNext
Loop
End If
End With
Set rs = Nothing
set db = Nothing
-----
Do I have to do the above code to get a Count of the records I specify in
the criteria parameter of the DCount function or can somebody think of a
better solution to solving Run-time error '3045'?
Please Help,
Thanks ---- Kan