Roman F
asked on
help me with Data Grid in access vba
Hi, experts.
I would like to ask you where to start with data grid control.
I have a simple form with a combo box with dates (populated from the main query) and I want to put data grid control or something else on same form to get the results of the query based on selected criteria from the combo box. The problem is I cannot find the data grid control or may be I can use something different instead of. Please help
I would like to ask you where to start with data grid control.
I have a simple form with a combo box with dates (populated from the main query) and I want to put data grid control or something else on same form to get the results of the query based on selected criteria from the combo box. The problem is I cannot find the data grid control or may be I can use something different instead of. Please help
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you very much
;-)
ASKER
I am sorry, where is the place where combo box connecting to list box???
But I have to also thank you for phrasing your question correctly:
<I want to put data grid control or something else on same form ...>
Many times a person hears about the Datagrid (or is used to using one in VB6), so they will only want a Datagrid solution.
By stating: "or something else", you made it clear that you just needed something to display the results.
This enabled aebea and I to get you a alternate solution quickly.
Enjoy the weekend...
;-)
JeffCoachman
<I want to put data grid control or something else on same form ...>
Many times a person hears about the Datagrid (or is used to using one in VB6), so they will only want a Datagrid solution.
By stating: "or something else", you made it clear that you just needed something to display the results.
This enabled aebea and I to get you a alternate solution quickly.
Enjoy the weekend...
;-)
JeffCoachman
ASKER
yes, you are right
ASKER
never mind, :))
thank you
thank you
<I am sorry, where is the place where combo box connecting to list box??? >
The combobox is not "connected" to the listbox.
What happens is that the Listbox "Looks" at the combobox for the criteria (filter)
You can see this by examining the RowSource Property of the listbox:
SELECT YourTable.rID, YourTable.rDate, YourTable.rCustID, YourTable.rAmount
FROM YourTable
WHERE (((YourTable.rDate)=[Forms ]![YourFor m]![Combo0 ]));
...Here the WHERE clause is the filter.
You can see that it points to the combobox.
So you can translate the SQL to say:
Display (SELECT) all fields
From YourTable
But only show records WHERE the rDate value is the same as the date in the combobox.
;-)
JeffCoachman
The combobox is not "connected" to the listbox.
What happens is that the Listbox "Looks" at the combobox for the criteria (filter)
You can see this by examining the RowSource Property of the listbox:
SELECT YourTable.rID, YourTable.rDate, YourTable.rCustID, YourTable.rAmount
FROM YourTable
WHERE (((YourTable.rDate)=[Forms
...Here the WHERE clause is the filter.
You can see that it points to the combobox.
So you can translate the SQL to say:
Display (SELECT) all fields
From YourTable
But only show records WHERE the rDate value is the same as the date in the combobox.
;-)
JeffCoachman
ASKER
and also, and that part i missed:
Private Sub Combo0_AfterUpdate()
Me.List2.Requery
End Sub
Private Sub Combo0_AfterUpdate()
Me.List2.Requery
End Sub
yes, ...
You need to requery the listbox each time you select a new value in the combobox.
As you can see, this is done on the After Update event of the combobox.
You need to requery the listbox each time you select a new value in the combobox.
As you can see, this is done on the After Update event of the combobox.
ASKER