473,796 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parameter query as a List box data source

66 New Member
Hello everyone!

Just in case anyone has any wonder about this... I have a parameter query that searchs for records that have the particular word provided by the user in a memo field (using the criteria Like "*" & [Enter the particular word] & "*"). I want those results displayed in a form. Additionally, a list box is mandatory, to skip from one record to another one.
Unfortunately, when using the list box wizard in this particular case, Access usually encounters a problem in the source data and does not generate the list box. Surprisingly, one day I eventually managed to have the list box made but I do not know why I was able too. It seems that, sometimes, Access does not display the "source data" message and succesfully completes all the steps in the list box wizard. Does anybody knows why is this happening? Has somebody encountered the same problems when setting a parameter query as a list box data source?
Sep 4 '08 #1
7 7730
NeoPa
32,579 Recognized Expert Moderator MVP
So, you don't know how you managed to get it to work, but you want someone to tell you why it does?

A big ask.

Let's see if we can get some basic facts down first in case there is something here that tells us anything.

I understand that you have a form which is bound to a query which has a parameter in it that needs to be entered whenever this query is run.
On the form are various controls bound to the fields to display from the said query.
Additionally you have an unbound ListBox control (not ComboBox) whose data source is exactly the same (the parameter query) as the form itself.
Now, whenever an item is selected in the ListBox, you have the form move the current record to match the newly selected value.

Is this an accurate description of your situation (Don't say yes unless you know it to be true)?
Sep 6 '08 #2
limperger
66 New Member
Dear NeoPa:

This is exactly the situation, word by word. Simply put, most people want to learn how to populate a parameter query via a listbox (and they are redirected to the excellent and very useful Martin Green's Access tips website); I would need the other way round: how to populate a listbox (in a form) with a parameter query.

I have very little idea of VBA, though I plan to learn more about it in the near future. I don't know, if you or anybody else would like to post its answer in this thread, if a VBA solution is mandatory here (I hope not), but I do know that, somehow, at least once I've managed to get it right.

Usually, when using the list box wizard (in a form in which its data source has already been set to be the parameter query of interest), once you select the fields you need, it is not possible to move forward to the next step (in which a sample of the final list box's appeareance is shown). Instead, I get a message like that (translated from spanish): "From the selected data source, data cannot be retrieved. A different query or table must be selected to continue with the wizard". Any wonder of why is this happening??

Everybody here has been very fond with me and the topics I have submitted. I have tried to help other people to the best of my knowledge too. Maybe this forum is not for me yet, but I am happy to post in here. Perhaps anybody could suggest other known forums in which user-level (beginner-intermediate; no VBA use) Access is discussed.

Anyway, I have got different copies of the version that works, so a solution to this enigma is not urgent at all. It is only that I don't know why this happens and I would like to find out. It is also true, and I acknowledge this point, that I should have written down some tips the time I succeded in get it right. In fact, I believed I did but, unfortunately, I'm afraid I did not...

Best regards!
Sep 8 '08 #3
tkip
16 New Member
Refer to the thread below. Someone at this post is looking for the solution you have and you are looking for the explanation of the solution.

I posted the codes that does what you describes. I think it should help.

http://bytes.com/forum/thread825372.html
Sep 8 '08 #4
NeoPa
32,579 Recognized Expert Moderator MVP
Refer to the thread below. Someone at this post is looking for the solution you have and you are looking for the explanation of the solution.

I posted the codes that does what you describes. I think it should help.

http://bytes.com/forum/thread825372.html
I commend you for your courage in even reading that thread.

I'm not sure of the wisdom of directing hitherto sane members that way.

I think the wisest solution is to post a more succinct answer in here. Unfortunately my faculties this evening seem a little impaired (alcoholic sabotage). Please feel free to bump tomorrow if you've not heard more from me.
Sep 8 '08 #5
limperger
66 New Member
Hey!

Somehow I made it and this time I have been wise enough to keep some notes on how should it be done. Let me post it later. No VBA needed!!
Sep 9 '08 #6
NeoPa
32,579 Recognized Expert Moderator MVP
Please do that Limperger :)

I will run my eyes over it for you if you do, and let you know if it seems good sense.
Sep 9 '08 #7
limperger
66 New Member
Hello everyone!

Here's my explanation:

First, just to set things straight: I have got an Access file with a main table ("tbl" from now on), and a main form ("frm" from now on) linked to the table (with a listbox that helps to skip from one record to another). There is a memo field intended to store a final comment regarding the whole entry.

The idea here is to search tbl looking for entries that have a keyword the user provides in the memo field (a parameter query is used here). But, taking advantage of frm, results should be displayed using frm; in other words, it is like filtering tbl (by the keyword provided by the user) but displaying the results in a form, instead of a query datasheet.

Beginning with frm, one should expect that changing the data source, for both the listbox and the form, to the parameter query, it should work. But, at least for me, it does not. Also, it doesn't work if you change the data source for the form (and choose the parameter query instead of tbl (the main table)), delete the original listbox and try to create a new one via the listbox wizard. Here (in a step of the wizard) appears the aforementioned (in my previous posts) textbox that the data source chosen is not valid.

I have been able to overcome this situation as follows:

Step 1: Starting with the original form, frm, delete the original listbox. The form's data source is still set to be the main table, tbl.

Step 2: Create a new listbox, using the listbox wizard. Since the form's data source is the main table, the list of fields available comes from the main table, by default.

Step 3: Change the listbox data source to the parameter query, creating a new query in the "data source" option of the listbox properties.

Step 4: Change the main form's data source to the parameter query, instead of the main table.

If Step 4 is implemented, when launching the new form, the user is prompted to enter the keyword twice: for the listbox and for the form. The parameter query launches, then, twice, as it serves as data source for both the form and the litsbox. This can be solved if step 4 is skipped. Then the situation would be the following one: the data source for the listbox is set to be the parameter query but the data source for the form is still set to be the main table, tbl. Obviously, the use of a mousehook here is mandatory so as to assure that users can only skip from one record to another via the listbox and not the mousewheel.

In conclusion, I do not know why the listbox in the form must be created again de novo. But I can safely say that I have tried every possible combination and this is the only one that works. Some kind of Access malfunction here?

I hope I will be understandable and of help!

Best regards
Sep 15 '08 #8

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

Similar topics

3
13001
by: Aaron | last post by:
Hello, I'm trying to limit a report to a list of parameters that I pass in. The report and the underlying query both use the column FirstName. Whenever I try to limit the FirstName in via the "Where" clause, I get prompted to input the FirstName parameter, even though I'm passing it in via OpenReport The syntax I tried using:
6
2779
by: sheree | last post by:
I would like to create a query where one of the columns of the queries comes from a combo list box on a form. For example, if my table has the following fields: id name interest1 interest2 interest3 my combo box would be a dropdown containing these choices:
4
3525
by: Theo Jansen | last post by:
Hi, i'm making an application in Access and in the query made, i'd like the user to fill in a parameter when opening the query (in a report). It's much easier for the user if the parameter was a dropdown list from which he can select, because the parameters are rather long... Does anyone know how to make that dropdown list? TIA
0
4808
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having manually inserted a row in the table bound to the Combo box. The InsertAt Method of adding a row just does not work. Hope this helps anyone with this problem. john
3
4096
by: Daron | last post by:
Is it possible to use a parameter as the field name, not just a criteria? Snippet of my SQL: SELECT Eval("!!.(0)") AS TestField, AS from qry_main The parameter will hold the name of the field. In the first column, I want to show the name of the field for all records. In the
2
1724
by: daralick | last post by:
I have a form with two subforms. The main form holds the Order Number and basic information. The 1st subform holds an abbreviated list of products in the order and the data source is a table that uses master and child fields to populate. The 2nd subform holds product details and I am attempting to use a query with one parameter to populate details. On the form load the product detail should be the first product in the 1st subform. ...
6
12473
by: fieldja | last post by:
I have a form called OwnerForm. It contains a combo box called Owner. The combo box looks up names from a table called OwnerName. It contains fields called OwnerID and Owner. I also have a main form called ProjectsForm. This form has several fields to enter data. I have a query that is called Owner Query. This query contains the fields IDNumber.Projects2 Team.Projects2 and Owner.OwnerName getting information from tables. On the...
3
7703
by: Darin | last post by:
I have a problem I just can't figure out. I have a form with a subform, and the recordsource of the subform has criteria based on some unbound fields in the parent form so that data in the parent form affects data in the subform. I've had this type of setup often, but I've run across a couple forms where this has caused an "enter parameter value" pop up for each reference to the parent control in the query when the main form is closed. ...
1
2206
by: limperger | last post by:
Hello everyone: First and foremost: I find this case below difficult to explain so let me hereby present my apologies if someone's willing to help but does not understand what is all this thing about...Just let me know and I will try to explain it better. I've got a form with a list box. The list box type is that in which the data for the record selected automatically appears in the form. The records (ctrl source) come from a parameter...
0
9524
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.