Results 1 to 4 of 4

Thread: Ammending code to show on data bound grid

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2003
    Posts
    509

    Resolved Ammending code to show on data bound grid

    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:
    1. Private Sub Form_Load()
    2.     Set r = GetData
    3.     textbox1.text = r![InvoiceNo]
    4. End sub
    5.  
    6. Public Function GetData() As ADODB.Recordset
    7. On Error Resume Next
    8. Dim strsql As String
    9. Dim r As ADODB.Recordset
    10. Dim c As ADODB.Connection
    11.  
    12. Set c = New ADODB.Connection
    13. c.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False; Data Source=.\home.mdb;"
    14. c.Open
    15.  
    16. strsql = "SELECT * from Invoice"
    17. Set r = New ADODB.Recordset
    18. r.Open strsql, c, adOpenDynamic, adLockPessimistic
    19.  
    20. Set GetData = r
    21. End Function
    Last edited by snipered; Nov 21st, 2004 at 05:51 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width