Library code snippets

Basic ADODC Example

Too all you newbies out there, This is something I wrote for a friend of mine, teaching how to use the basic extraction-from-db utilities. It shows how you can link an Access database using the ADODC Component. It includes thorough explanations and examples. It really is teaching the basics of ADODC components - nothing fancy - I just remembered my own time as a beginner, trying to search for new ways to learn. I hope it will help you :) ~moo

Comments

  1. 25 Sep 2008 at 01:45

    hello..i am wanting to search the access database that i made with the visual data manager.

    I have a search button, datagrid, an adodc connected to the database, its reading the database well alright on the VB 6.0 form.

    I want to be able to click on the search button to fire even if no database has not yet been entered with Data without declaring bookmark within the code.

    Whenever i click on the search button to fire the event to search the database, though it has not yet been populated with data, it flags and debugs the bookmark declaration.

    Here is the code i used on the search button to search the access database on the vb form connected to the adodc.

    Private Sub CmdSearchGrid3_Click(Index As Integer)
    Dim searchvar As String
    Dim sBookMark As String
    searchvar = InputBox("Enter the Country to find")
    searchvar = Trim$(searchvar) ' removes surplus spaces
       If searchvar <> "" Then 'cancel if nothing entered
       With Data1.Recordset
       sBookMark = .Bookmark
       .FindFirst "Country like '" + searchvar + "*'"
         If .NoMatch Then ' record not found
         MsgBox "No matching record"
         .Bookmark = sBookMark
         End If
       End With
       End If
    End Sub

    This code when the search button is fired flags the sBookMark = .Bookmark debug because the database hs no data, well enough.

    Can you help me out here to enable the search button to fire an empty database and return No matching record. I dont know how to get rid of the .Bookmark function?

    cheers

    Paul Martins

  2. 16 Jun 2008 at 04:32

     How can i search a string inlcuding '  example   'John

  3. 27 Feb 2007 at 08:54

    hey im new in VB and i downlaoded your code, and i wonder if you could help me on my baby thesis.My problem is just how to edit the records on my database using a command button.Here is my first form:

    http://i69.photobucket.com/albums/i70/lhouwhie/form1.gif

    When i click the "Edit" button the following form loads:

    http://i69.photobucket.com/albums/i70/lhouwhie/form2.gif

    Then when o click on the "Save" button nothing happens, when i go back to the dirst form the records just stays the same.

    Here's my code for the "Save" button (i haven't put trappings yet):

    Private Sub cmdsave_Click()
    Adodc1.Refresh
    Adodc1.Recordset.Fields("Firstname") = txtfname.Text
    Adodc1.Recordset.Fields("Lastname") = txtlname.Text
    Adodc1.Recordset.Fields("Address") = txtaddress.Text
    Adodc1.Recordset.Fields("ContactNumber") = txtcnum.Text
    Adodc1.Recordset.Fields("Birthdate") = txtbirth.Text
    Adodc1.Recordset.Fields("UserLevel") = cmblvl.Text
    Adodc1.Recordset.Fields("Gender") = cmbgen.Text
    Adodc1.Recordset.Update
    Adodc1.Refresh
    End Sub










    thanks in advance and God Bless

     

  4. 01 Jan 1999 at 00:00

    This thread is for discussions of Basic ADODC Example.

Leave a comment

Sign in or Join us (it's free).

Moriel Schottlender
AddThis

Related discussion

Related podcasts

  • Christian Beauclair

    14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...

We'd love to hear what you think! Submit ideas or give us feedback