Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

help me with Data  Grid in access vba

Posted on 2013-05-17
13
Medium Priority
?
1,116 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 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
Independent Software Vendors: 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!

 
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 Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

916 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