Normally when i open an ado code i do it as the code is below.
I would like to know how to ammend the code so it shows it in a databound grid???????????????
I know it has something to do with datasource property but cannot work out the correct place to place it and what to call it with.
I no longer want to show it in a textbox.
VB Code:
Private Sub Form_Load() Set r = GetData textbox1.text = r![InvoiceNo] End sub Public Function GetData() As ADODB.Recordset On Error Resume Next Dim strsql As String Dim r As ADODB.Recordset Dim c As ADODB.Connection Set c = New ADODB.Connection c.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False; Data Source=.\home.mdb;" c.Open strsql = "SELECT * from Invoice" Set r = New ADODB.Recordset r.Open strsql, c, adOpenDynamic, adLockPessimistic Set GetData = r End Function




Reply With Quote