Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SDETERS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to write script (correct my script) for MSFlexGrid

Status
Not open for further replies.

gilgalbiblewheel

Computer
Jun 6, 2006
5
How do I make the script run through the database and write down the records of rs("book_title"),rs("chapter"),rs("verse"),rs("text_data") in a MSFlexGrid?

Code:
Private Sub MSFlexGrid1_Click()
 'Private Sub Form_Load()
    'the format string just lets you define a format for how
    'your flexgrid will appear
    MSFlexGrid1.FormatString = "Book             |" & _
        "Chapter                                 |" & _
        "Verse                                   |" & _
        "Text"
        
    Dim connectionString As String
    Dim query As String
    Dim cn As New ADODB.Connection
    Dim cmd As New ADODB.Command
    Dim rs As New ADODB.Recordset
    Dim Text1
    
    'Text1 = Request("Text1")
    
    'connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\kjv.mdb;User Id=admin;Password=;"
    'query = "SELECT * from bible"
    ''query = "SELECT * from bible WHERE text_data LIKE %" & Text1.Text & "%"


    'make sure the search path to the db is always in the right spot
    Data1.DatabaseName = App.Path & "\kjv.mdb"
    
    'set up the recordsource for the datasource and flexgrid control
    'in this case, it's just a raw SQL query, simple simple.
    Data1.RecordSource = "select * from bible order by id"

    
    cn.connectionString = connectionString
    'cn.Open
    'cmd.ActiveConnection = cn
    cmd.CommandText = query
    
    
    'Set rs = cmd.Execute
    
    
    'While rs.EOF <> True
        'MsgBox (rs("book_title") & " " & rs("chapter") & ":" & rs("verse") & " " & rs("text_data"))
        'rs.MoveNext
        
    'Wend
    'Do Until rs.EOF <> True
        'list1.AddItem (rs("book_title") & " " & rs("chapter") & ":" & rs("verse") & " " & rs("text_data"))
        'rs.MoveNext
    'Loop
    'Do
    'If MsgBox(rs("book_title") & " " & _
    '            rs("chapter") & ":" & _
    '            rs("verse") & " " & _
    '            rs("text_data"), vbOKCancel) = vbCancel Then Exit Do
    'rs.MoveNext
    'Loop Until rs.EOF

    'rs.Close
    'cn.Close
End Sub
 
Replies continue below

Recommended for you

Are you really sure that this is an engineering problem? The context of the code suggests you need a religious programming site, not a site (like this) specifically for professional engineers. I tried to Google for 'religion' and 'programming' but I found a lot of weird stuff - you may do better!

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

Steam Engine enthusiasts:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor