Results 1 to 4 of 4

Thread: should be an easy one but noone can answer it please help me!!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Posts
    103

    Angry

    Code:
    Private Sub Command1_Click()
    
    Dim dyna As Recordset
    Dim TheError As Long
    Dim theid As Long
    
     theid = txtCandidateID
    SQL= "select historydate,historyconsultant,historyaction,historyquicknotes from candidate  where candidateID = " & theid & "'"
    On Local Error Resume Next
    
    Set dyna = db.OpenRecordset(SQL, dbOpenDynaset,dbSQLPassThrough + dbSeeChanges)
    TheError = Err
    On Local Error GoTo 0
    
    MSFlexGrid1.Clear
    Select Case TheError
    Case 3146
    'case 3146 means there are no records in the database 
    
    Case 0
    
    
        MSFlexGrid1.AddItem dyna("historydate")
        MSFlexGrid1.AddItem dyna("historyconsultant")
        MSFlexGrid1.AddItem dyna("historyaction")
        MSFlexGrid1.AddItem dyna("historyquicknotes")
        
    End Select
    dyna.Close
    Set dyna = Nothing
    End Sub
    i want to open my database and display my result in my flexigrid control????

    help me please
    my database opens up perfectly but i dont know how to get my data from my database and put it in my msflexgridcontrol
    i do not want to use any datacontrols i want to do this programmically...because my SQl statement does not work with
    datacontrols due to the fact that it does not picksup my variable theid as a value i come up with errors!!!!
    im also using an SQL 7 Database???
    anyone any ideas???









  2. #2
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    msflexgrid.additem ""


    MSFlexGrid1.textmatrix(msflexgrid1.rows-1,0)= dyna("historydate")
    MSFlexGrid1.textmatrix(msflexgrid1.rows-1,1)= dyna("historyconsultant")

    etc

    ' MSFlexGrid1.AddItem dyna("historyconsultant")
    ' MSFlexGrid1.AddItem dyna("historyaction")
    ' MSFlexGrid1.AddItem dyna("historyquicknotes")
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  3. #3
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373

    Lightbulb

    Hi,

    I assume that you copy and paste the code, if so then check the change pls.

    Code:
    Private Sub Command1_Click()
    
    Dim dyna As Recordset
    Dim TheError As Long
    Dim theid As Long
    
     theid = txtCandidateID
    
    'Change Begins
    SQL= "select historydate,historyconsultant,historyaction,historyquicknotes from candidate  where candidateID = '" & theid & "'"  '<<<---- The Variable should appear like this ->  "Select * from table where field = 'This'" 
    'Change ends.
    
    On Local Error Resume Next
    
    Set dyna = db.OpenRecordset(SQL, dbOpenDynaset,dbSQLPassThrough + dbSeeChanges)
    TheError = Err
    On Local Error GoTo 0
    
    MSFlexGrid1.Clear
    Select Case TheError
    Case 3146
    'case 3146 means there are no records in the database 
    
    Case 0
    
    
        MSFlexGrid1.AddItem dyna("historydate")
        MSFlexGrid1.AddItem dyna("historyconsultant")
        MSFlexGrid1.AddItem dyna("historyaction")
        MSFlexGrid1.AddItem dyna("historyquicknotes")
        
    End Select
    dyna.Close
    Set dyna = Nothing
    End Sub
    did you check this...

    Saludos...
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

  4. #4
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    you lost me... you query the data base then you want to load its contents into a flex grid.

    this is how I do it

    grid.rows=0
    grid.cols = 3

    set rs = db.openrecordset("select * from cars")

    do until rs.eof

    grid.additem ""
    grid.textmatrix(grid.rows-1,0) = rs.fields(0)
    grid.textmatrix(grid.rows-1,1) = rs.fields(1)
    grid.textmatrix(grid.rows-1,2) = rs.fields(2)
    rs.movenext
    loop

    rs.close
    Kurt Simons
    [I know I'm a hack but my clients don't!]

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