create an ODBCDataSet via VBA in processbook

Discussion created by andrew_Inwood on Jul 18, 2013
Latest reply on Sep 9, 2013 by andrew_Inwood

The sample code in the VBA help file is:



Dim Application As Object
Dim MyDatasets As Datasets
Dim MyDataset As Dataset

Set MyDatasets = Application.Datasets
Set MyDataset = MyDatasets.Add("NewODBCDataSet",NULL, True, 1, True, pbcDatasetODBC)

MyDataset.Query = "Select * from tlbData"

 Unfortunately, it doesn't work. 


I've been trying to fix it, and have removed the "Dim Application as Object" (which is not needed in the VBA editor anyway). 


I get an "Object required" error in the line: 

Set MyDataset = Application.Datasets.Add("NewODBCDataSet", Null, True, 1, True, 3)

 Has someone got some sample code that actually works?