-
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???
-
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")
-
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...;)
-
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