Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Redraw invalid use of property.

Status
Not open for further replies.

hpicken

Technical User
Apr 12, 2001
142
AU
I'm trying to using the following bit of code to fill a flexgrid but get an error stating that the ReDraw is invalid use of property. Can someone please enlighten me why.

Code:
Private Sub btnShowAll_Click()
    Set rs = New ADODB.Recordset
    rs.ActiveConnection = cn
    rs.Source = "SELECT * FROM tblNewSearch ORDER BY SurName"
    rs.CursorLocation = adUseClient
    rs.CursorType = adOpenDynamic
    rs.LockType = adLockOptimistic
    rs.Open
    Set MSFlexGrid1.DataSource = rs
    MSFlexGrid1.Redraw
End Sub

Private Sub Form_Load()
Set cn = New ADODB.Connection
    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\TCRDataSplit.mdb;"
    cn.Open
End Sub

Private Sub Form_Unload(Cancel As Integer)
    rs.Close
    Set rs = Nothing
    cn.Close
    Set cn = Nothing
End Sub
 
Hi:

The flexgrid Redraw property takes a boolean value. Thus, you will want either MSFlexGrid1.Redraw = True or MSFlexGrid1.Redraw = False.

I suspect that you are needing the Refresh function.

Cassie
 
If I use Redraw I get a different error

Run-time Error 91
Object Variable or With block variable not set

stopping on line

Set MSFlexGrid1.DataSource = rs

From the examples here on tek-tips I thought I would not have to do any looping of some sort.



cheers
Howard
 
That control does not allow you to do this with ADO recordsets.
Either use the MSHFlexgrid or use a ADODC data control. I would either use the first one or use another (better) grid control.



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
OK thanks Frederico, I have a play with other types of grids

If I don't play I'll never learn so once again thanks.


cheers
Howard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top