Solved

help me with Data  Grid in access vba

Posted on 2013-05-17
13
1,052 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now