Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

help me with Data  Grid in access vba

Posted on 2013-05-17
13
Medium Priority
?
1,109 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 200 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 1800 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

721 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