T
Tom Rogers
I'm trying to perform a filter on a table so I can cycle through records.
I've looked through the help available online and in Access, and have come
up with the following code:
---
Public Function GetParents()
Dim dbsThis As Database
Dim rParents As Recordset
Dim iParents As Integer
Set dbsThis = CurrentDb
Set rParents = dbsThis.OpenRecordset("Parents", dbOpenSnapshot)
. . .
End Function
---
When I run this code (which is called by a report detail's OnFormat event),
I get Error Code 13 'data type mismatch' on the last line, where I use the
OpenRecordset method on dbsThis.
I've tried everything I can think of (which isn't much). This code is 100%
identical to a function provided in the built-in help, with variable names
changed.
I don't know what's going on. Originally the recordset I was trying to open
was a linked table, but I found a note saying the OpenRecordset method does
not necessarily establish links to linked tables. I didn't think it applied
since this code is run from inside the database, but I imported the table
and changed the code to rely on that table instead.
Any help would be appreciated. Thanks.
I've looked through the help available online and in Access, and have come
up with the following code:
---
Public Function GetParents()
Dim dbsThis As Database
Dim rParents As Recordset
Dim iParents As Integer
Set dbsThis = CurrentDb
Set rParents = dbsThis.OpenRecordset("Parents", dbOpenSnapshot)
. . .
End Function
---
When I run this code (which is called by a report detail's OnFormat event),
I get Error Code 13 'data type mismatch' on the last line, where I use the
OpenRecordset method on dbsThis.
I've tried everything I can think of (which isn't much). This code is 100%
identical to a function provided in the built-in help, with variable names
changed.
I don't know what's going on. Originally the recordset I was trying to open
was a linked table, but I found a note saying the OpenRecordset method does
not necessarily establish links to linked tables. I didn't think it applied
since this code is run from inside the database, but I imported the table
and changed the code to rely on that table instead.
Any help would be appreciated. Thanks.