Hi,
I have a form and a sub form, data on sub form is build dynamic based on certain contid coming from some other form. I am able to view data readonly but cant append. whereas if simple form is used in tabular mode i can set form.recordset property and hence append data, whereas in case of sub form i cant use recordset property. Can any body help please......... ..
Following is the sample code
Dim cn As New ADODB.Connectio n
Dim ars As New ADODB.Recordset
cn.ConnectionSt ring = "Provider=SQLOL EDB.1;Password= abc;Persist Security Info=True;User ID=sa;Initial Catalog=PKG;Dat a Source=ADT0293\ SQLEXPRESS"
cn.Open
With ars
.ActiveConnecti on = cn
.CursorLocation = adUseClient
.Source = "Select * from tbllist where contid = '5506597'"
.CursorType = adOpenKeyset
.LockType = adLockOptimisti c
.Open
End With
Forms!Form1!Lis t.Form.RecordSo urce = ars.Source
ars.Close
Set ars = Nothing
I have a form and a sub form, data on sub form is build dynamic based on certain contid coming from some other form. I am able to view data readonly but cant append. whereas if simple form is used in tabular mode i can set form.recordset property and hence append data, whereas in case of sub form i cant use recordset property. Can any body help please......... ..
Following is the sample code
Dim cn As New ADODB.Connectio n
Dim ars As New ADODB.Recordset
cn.ConnectionSt ring = "Provider=SQLOL EDB.1;Password= abc;Persist Security Info=True;User ID=sa;Initial Catalog=PKG;Dat a Source=ADT0293\ SQLEXPRESS"
cn.Open
With ars
.ActiveConnecti on = cn
.CursorLocation = adUseClient
.Source = "Select * from tbllist where contid = '5506597'"
.CursorType = adOpenKeyset
.LockType = adLockOptimisti c
.Open
End With
Forms!Form1!Lis t.Form.RecordSo urce = ars.Source
ars.Close
Set ars = Nothing