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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clear data from a datagrid

Status
Not open for further replies.

newprogamer

Programmer
Sep 22, 2004
107
US
Hello, Does anyone know how to clear the data from a datagrid? Thanks, so much!
 
Use the macro recorder!

It should look like this... something I am currently using to clear only selected ranges...

Code:
Private Sub cmdOk_Click()
    Union(Range("B111:H119,N111:O119,B124:H132,N124:O132,T7:Z15,AF7:AG15,T20:Z27,T20:Z28,AF20:AG28,T33:Z41,AF33:AG41,T46:Z54,AF46:AG54,T59:Z67,AF59:AG67,T72:Z80,AF72:AG80"), Range("T85:Z93,AF85:AG93,T98:Z106,AF98:AG106,T111:Z119,AF111:AG119,T124:Z132,AF124:AG132,B7:H15,N7:O15,B20:H28,N20:O28,B33:H41,N33:O41,B46:H54,N46:O54"), Range("B59:H67,N59:O67,B72:H80,N72:O80,B85:H93,N85:O93,B98:H106,N98:O106")).Select
    Selection.ClearContents
    Range("B7").Select
End Sub
 
Sorry Asspin, I need to be clearer.

It gets the data from an access database using a recordset, then displays it in the datagrid. Any ideas?
 
Simply set the DataSource to Nothing.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top