473,327 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

I have a form that has 2 listboxs.... The selection of each listbox is passed to a qu

I created 2 forms. the first form passes criteria to a query. I have a macro button that runs the query passing to info from the First form to the query. This is working just fine. Now I'm trying to get the results of that query to populate a second form which is then included on the first form as a Subform.... is this possible?
Jul 22 '14 #1
7 1071
Seth Schrock
2,965 Expert 2GB
Yes it is possible. Are you just using the list boxes to filter the results or you doing any changing of fields in your list boxes?
Jul 22 '14 #2
The list box(s) I created the criteria and stored it as the row source in the value list. I'm using 2 list boxes. They are not linked to any table. choosing a value in each list box gets passed to the Query I built. The query runs when a Control button is depressed running a Macro. They query runs great and I get back exactly what was asked in list boxes each time. Now I would like to have the results of this query show up in a SubForm attached to the Main form that supplies the criteria(when selected) to the initial Query. I have a 2nd form created and one of the features of the Macro is to open the 2nd form and populate it with the results of the query. it works but i can't seem to get this second form with the query result to show in the attached subform. I'm sure I have to have a procedure that requery's or some sort of after event. I'm looking to have this 2nd subform populate dynamically when the initial query is activated. I know I'm getting close but I've hit the wall with the my level of understanding. I'm not a programmer but I can understand some coding.. Any help suggestions is greatly appreciated.
Jul 22 '14 #3
Seth Schrock
2,965 Expert 2GB
That doesn't quite answer my question for sure, but I think that I know what the answer is that you are not dynamically building a query (changing field, etc.), but just filtering the results based on your selections in the listboxes.

If that is the case, then as long as your query is set to have its criteria based on the values of those controls, then all you need to do is have your button's OnClick event do a requery of the subform.
Expand|Select|Wrap|Line Numbers
  1. Me.SubformName.Form.Requery
Unfortunately, I don't know how to do this in a macro.
Jul 22 '14 #4
Yes the List Boxes act as filters in the query
Jul 22 '14 #5
Seth Schrock
2,965 Expert 2GB
What do your macros do currently?
Jul 22 '14 #6
Seth, Thank You very much I added your code string to my procedure with my form information and it's now working as invisioned. I know it was something simple like one line of simple code. Part of the code looks to the Macro and runs that portion and closes. Then the procedure takes over and reloads the query into the Subform dynamiclly.

thank you much. I'm sure I'll be back with more questions.
Jul 22 '14 #7
The Macro Opens a specific Query and runs with the criteria sent from the listbox(s) on the Main Form....then it Closes the query. This stops a seperate Query window from popping up.... and then Stops the Macro.
At this point the procedure takes over and Re query's the Form (Sub-form) and the Sub-form Populates dynamically. If you change your selection in any of the list boxes and hit the query button the sub-form loads with the new information dynamically. This is what I was looking to have happen.

Thank You Again.
Jul 22 '14 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: AK | last post by:
Hello, Listbox mulitselect property is set to true (extended). I am trying to implement drag and drop feature for a listbox. The drag & drop is done in the mouse move event (DoDragdrop...
10
by: aroraamit81 | last post by:
I have a string like "English,Japanese,Spanish" and a list box which contains say 10 lang. Now I want my List box should come by selected values as the values in string and rest of the values to...
0
by: Waran | last post by:
Hi, I have form where i am using a listbox where we can select multiple values.I am storing the selected values concatenating with commas(for eg. "22,21,19,16").Now i have to update this form, so...
1
by: Bob Alston | last post by:
Really wierd problem opening a form with selection. I use this code on a button: On Error GoTo Err_Command8_Click Dim stDocName As String Dim stLinkCriteria As String stDocName =...
4
by: bansh | last post by:
Hi all, As question title I need a javascript which provides the facility to make multiple selection without holding control key. Means I how is it possible to make multiple selection/deselction...
3
by: Shaileshsharma | last post by:
Hi, I am facing a problem from last few days.I have a ListBox which Multi selection property is true.I want to select more than one value from ListBox and save in my database.How it is...
9
by: Brett_A | last post by:
I have a form where the first field is a dynamic drop-down that pulls from a db (Access). The fields associated with the query are task_id, task_name and task_rate. The field has the value of...
0
by: =?Utf-8?B?UGFvbG8=?= | last post by:
Given the following data model: Category ---< Sub-category (1 to many) with Category and Sub-category being two SQL Server tables, I want to list the Category in a ComboBox such that...
0
by: Stephen Heather | last post by:
hi, i have 4 list boxes that need to have one row from one list box added to the other, then taking from there list boxes and added to another list box together. for instance member of...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.