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

Determining data to display in a DataGrid (VB6)

Status
Not open for further replies.

DeepBlerg

Technical User
Jan 13, 2001
224
AU
Hi guys,
i've now got a datagrid which i need to populate with records from a mdb table depending on what is selected in two combo boxes.

I have two combo boxes which display date from and date to and i need some code that puts records into the datagrid between the two dates selected in the combo boxes....so if anyone could help out , i'd be grately appreciative.
 
I would create and ado control to your table and then bind your datagrid to the your ado control. Then after you have selected your two dates and fire off the process

1. First build a query using those dates and associate it with your ado recordource.

adoControl.recordsource = &quot;Select * from table where DateField > '&quot; & cboBeginDate and &quot;' and DateField < '&quot; & cboEndDate &quot;'&quot;

2. adoControl.Refresh - This will execute the query and refresh you datagrid with the needed information.

Another way is to build your query like above and then cycle through the recordset and insert the records into the datagrid.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top