|
|
In establishing simple functions or sub procedures, when ever I use
the SET keyword I receive a "Run time error 13: Type mismatch. Why?
An example of some code producing the error appears below:
Private Sub cmdRecordset_Click()
Dim rst As ADODB.Recordset
Set rst = Me.RecordsetClone
rst.MoveFirst
Do
Debug.Print rst!LastName
rst.MoveNext
Loop Until rst.EOF
End Sub
P.S What am I doing wrong?
|
| |
Write Dim rst as New ADODB.Recordset
Instead of
Dim rst as ADODB.Recordset |
|
|
Can
I use ADO and DAO in the same database file? |
| |
The
short is yes. You will need to have references to both type
libraries. You may also require other precautions, such as using
ADODB and DAO as prefixes for Recordset object declarations. |
|
|
What
is an ADO recordset filter? |
| |
A
filter in ADO permits you to create a subset of the current recordset
that matches a criterion expression. This expression has the same
form as a SQL WHERE clause argument. By setting the a recordset's Filter
property to adFilterNone, you can restore the original recordset with
which you were working. You can learn more about the recordset
Filter property from the Object Browser. See page 23 of
Programming Microsoft Access 2000 for instructions on how to use the
Object Browser. |
|
|
When
I use the ADO Find method with a compound criterion, it fails.
However, it works fine with a simple criterion. What's the right
syntax for a compound criteria with the ADO Find method? |
| |
There
is none because the Find method with ADO 2.1 and 2.5 does not accept
compound criteria. One workaround is to use a SELECT statement
with a compound criterion as the source argument for the Open method of
a Recordset object. |
|
|
Where can a find an introduction to programming ADO
recordsets in Access 2000? |
| |
Go to the ADO
Overview on this site and navigate to the pages on the Recordset and
Field objects. |
|
|
How many recordset types are there with Access 2000? |
| |
There are two recordset types with Access 2000. The
DAO recordset type is appropriate when you require compatibility with
earlier versions of Access and when you are working exclusively with Jet
data sources. The ADO recordset type works with any data source
type, including Jet, SQL Server, MSDE, and all ODBC data sources.
ADO is an element of Microsoft's Universal Data Access strategy. |
|
|
How do I programmatically set the record source for a
form? |
| |
You can set either the form's RecordSource or Recordset
property. When using the RecordSource property, you are limited to
designating a string that points at a table, query, or a SQL
statement. Use the Recordset property to retrieve of set the
record source for a form. The Recordset property is more flexible
than the RecordSource property since you can both set and retrieve a
form's record source with the Recordset property. In
addition, you have more flexibility with respect to objects for setting
a form's record source. |
|
|
How do I set the AbsolutePage property for a recordset? |
| |
Set the AbsolutePage property in coordination with the
PageSize property. The AbsolutePage property takes integer values
from 1 through the number of pages in a recordset. The larger the
PageSize setting the fewer the upper limit of the number of
settings. You will always have a AbsolutePage value of 1, and you
may have 2, 3, 4, etc. Just assign a value to the AbsolutePage
property, and you will be able to enumerate records from the top of that
page. |
|
|
How do I get a VBA procedure in a Microsoft Access
project to use the default parameter of a stored procedure in a database
on a stored procedure? |
| |
This will happen automatically before you set the ADO
parameter's value the first time. After setting its value once,
you must reset it to Empty in order to tap the default value for a
parameter in a SQL Server stored procedure. See Rick Dobson's
column in SQL Server Magazine for an example of how this works. |
|
|
I read somewhere on the Microsoft site that requesting
the Recordset object for a current form always returns a DAO recordset,
does that mean that the Recordset object only works with DAO recordsets? |
| |
Yes and No. The answer is Yes when you are working
with a Jet 4.0 data source. The answer is No when you are working
with either a MSDE or SQL Server data source. View the text for
the Recordset property in the Access 2000 Help files for more
details. |