Write your own customized handler
Applies to: Access 2013 | Access 2016
You may want to write your own handler if you are an IIS server administrator who wants the default RDS support, but more control over user requests and access rights.
The MSDFMAP.Handler implements the IDataFactoryHandler interface.
IDataFactoryHandler interface
This interface has two methods, GetRecordset and Reconnect. Both methods require that the CursorLocation property be set to adUseClient.
Both methods take arguments that appear after the first comma in the "Handler=" keyword. For example, "Handler=progid,arg1,arg2;"
will pass an argument string of "arg1,arg2"
, and will pass an argument string of "arg1,arg2"
, and "Handler=progid"
will pass a null argument.
GetRecordset method
This method queries the data source and creates a new Recordset object using the arguments provided. The Recordset must be opened with adLockBatchOptimistic and must not be opened asynchronously.
GetRecordset arguments
conn The connection string.
args The arguments for the handler.
query The command text for making a query.
ppRS The pointer where the Recordset should be returned.
Reconnect method
This method updates the data source. It creates a new Connection object and attaches the given Recordset.
Reconnect arguments
conn The connection string.
args The arguments for the handler.
pRS A Recordset object.
msdfhdl.idl
This is the interface definition for IDataFactoryHandler that appears in the msdfhdl.idl file.
[
uuid(D80DE8B3-0001-11d1-91E6-00C04FBBBFB3),
version(1.0)
]
library MSDFHDL
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
// TLib : Microsoft ActiveX Data Objects 2.0 Library
// {00000200-0000-0010-8000-00AA006D2EA4}
#ifdef IMPLIB
importlib("implib\\x86\\release\\ado\\msado15.dll");
#else
importlib("msado20.dll");
#endif
[
odl,
uuid(D80DE8B5-0001-11d1-91E6-00C04FBBBFB3),
version(1.0)
]
interface IDataFactoryHandler : IUnknown
{
HRESULT _stdcall GetRecordset(
[in] BSTR conn,
[in] BSTR args,
[in] BSTR query,
[out, retval] _Recordset **ppRS);
// DataFactory will use the ActiveConnection property
// on the Recordset after calling Reconnect.
HRESULT _stdcall Reconnect(
[in] BSTR conn,
[in] BSTR args,
[in] _Recordset *pRS);
};
};
See also
- Access for developers forum
- Access help on support.office.com
- Access help on answers.microsoft.com
- Access forums on UtterAccess
- Access developer and VBA programming help center (FMS)
- Access posts on StackOverflow
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.