ryan.gillies
Registered User.
- Local time
- Today, 17:43
- Joined
- Apr 8, 2011
- Messages
- 53
Hi everyone
I'm working on a bit of VBA in Excel that's going to pull out some record counts for me based on various criteria. It's a work in progress, but I'm stuck on a rather annoying hurdle. Here's the code:
Everytime I run this code I get an error 3061: Too few parameters. Expected 1.
I'm guessing I'm missing something from my OpenRecordset statement, but I can't for the life of me figure out what. I've tried adding dbOpenDynaset as a type, but without success. Any thoughts...?
I'm working on a bit of VBA in Excel that's going to pull out some record counts for me based on various criteria. It's a work in progress, but I'm stuck on a rather annoying hurdle. Here's the code:
Code:
Sub ExportFigs()
Dim DBPath As String
Dim db As Database
Dim rs As Recordset
DBPath = "[URL="file://\\gents02\shared\complain\Aardvark\mdbstore\Aardvark_backend.mdb"]\\gents02\shared\complain\Aardvark\mdbstore\Aardvark_backend.mdb[/URL]"
Set db = OpenDatabase(DBPath)
Set rs = db.OpenRecordset("SELECT * FROM tFile WHERE FileName=XXX")
MsgBox (rs.RecordCount)
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
End Sub
I'm guessing I'm missing something from my OpenRecordset statement, but I can't for the life of me figure out what. I've tried adding dbOpenDynaset as a type, but without success. Any thoughts...?