hi every one i have been trying to do somthing for some time but failed how to do it
i have an access 2000 database pasword protected
i have made a successfull connection to the database
but what i want to do is the results fro the recordset to be displayed in the msflexigrid control and this is done thru code at run time
say
db=active connection
set rs=new adodb.recordset
strsql="select * from customers where attdays='" & txtattdatys & "';"
rs.open strsql,db
if rs.eof and rs.bof then
msgbox "no data found"
exit sub
end if
what follows here is the code to put all the records found to an msflexigrid control
pliz help
Comments
:
: i have an access 2000 database pasword protected
: i have made a successfull connection to the database
: but what i want to do is the results fro the recordset to be displayed in the msflexigrid control and this is done thru code at run time
:
: say
:
: db=active connection
:
: set rs=new adodb.recordset
: strsql="select * from customers where attdays='" & txtattdatys & "';"
: rs.open strsql,db
: if rs.eof and rs.bof then
: msgbox "no data found"
: exit sub
: end if
:
: what follows here is the code to put all the records found to an msflexigrid control
:
: pliz help
:
:
:
:
:
:
This is the code I use to do that with a data grid:
txtQry.Text = the SQL Statement to execute
dg = equals the data grid control
NOTE: you have to make sure you use the SET statement for this to work and if the recordset is closed the data will be removed from the grid
[code]
Set objRSINFO = New ADODB.Recordset
strSQL = txtQRY.Text
With objRSINFO
.ActiveConnection = objConn
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.Source = strSQL
.Open
Set dg.DataSource = objRSINFO
dg.Refresh
End With
[/code]
Hope it helps
[blue]
C:Dos
C:Dos Run
Run Dos Run
[/blue]