Solved

help me with Data  Grid in access vba

Posted on 2013-05-17
13
1,099 Views
Last Modified: 2013-05-17
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
0
Comment
Question by:rfedorov
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
13 Comments
 
LVL 10

Assisted Solution

by:Anthony Berenguel
Anthony Berenguel earned 50 total points
ID: 39175087
I don't know about Access 2012, but previous version of Access do not support the data grid view control. Unless anyone else has a better approach, I think you will have to settle with using a subform with either continuous form view or datasheet view.
0
 

Author Comment

by:rfedorov
ID: 39175109
thank you for the fast respond, any other idea?
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 450 total points
ID: 39175272
<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. >
I see no reason why you cannot use a subform (or even a Listbox) to display these results.
0
Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39175310
like so:
screenDatabase43.mdb
0
 

Author Closing Comment

by:rfedorov
ID: 39175355
thank you very much
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39175461
;-)
0
 

Author Comment

by:rfedorov
ID: 39175470
I am sorry, where is the place where combo box connecting to list box???
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39175477
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
0
 

Author Comment

by:rfedorov
ID: 39175496
yes, you are right
0
 

Author Comment

by:rfedorov
ID: 39175506
never mind, :))
thank you
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39175513
<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]![YourForm]![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
0
 

Author Comment

by:rfedorov
ID: 39175800
and also, and that part i missed:
Private Sub Combo0_AfterUpdate()
Me.List2.Requery
End Sub
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39175850
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question