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
Solved

help me with Data  Grid in access vba

Posted on 2013-05-17
13
1,082 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
  • 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
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, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

808 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