Hi All
In the module i write this
Code:Public Sub test() Dim con1 As New adodb.Connection con1.CursorLocation = adUseClient con1.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=test" con1.Open Dim k As New adodb.Recordset Set k = New adodb.Recordset k.Open "select * from table3", con1, adOpenDynamic, adLockOptimistic Set Form1.DataGrid1.DataSource = k End Sub Public Sub count() Dim con1 As New adodb.Connection con1.CursorLocation = adUseClient con1.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=test" con1.Open Dim k As New adodb.Recordset Set k = New adodb.Recordset k.Open "select * from table3", con1, adOpenDynamic, adLockOptimistic MsgBox k.RecordCount End Sub
in the form1
the form_load work and the module fill the datagrid1 with the dataCode:Private Sub Form_Load() test End Sub Private Sub Command1_Click() count End Sub
but when i click command1 to count the record i receive this error
"Compile Error: Function or Interface Marked as Restricted, or the Function
Uses an Automation Type Not Supported in Visual Basic"
when i move the code in count() to form1.. it work
please help me out in this problem
regards for all




Reply With Quote