473,657 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to display query results in a subform

48 New Member
Good day everyone,

I have a database with 2 main forms. The first form is used to add records to the database and contains a command button that opens the 2nd form for records searching.

On the second form I have tow combo boxes that I would like to search from. Currently, I just have the search button run a query which opens in a separate screen. This is the same for both combo boxes (they are independent of each other). I would like to have the results open on the form in a subform but before I can do that I need to be able to view only certain results. What I want is for the command button to run a query that only displays results that match the text in the combo box. When I try to limit that results to that I get no results returned. If I just run the query without any qualifying where clause I get everything in the query just fine.

After I get that fixed I want to display the results in a subform on my search form. Is any of this possible?

Any help would be greatly appreciated.

Thank you,
Doug
May 5 '08 #1
16 7954
NeoPa
32,568 Recognized Expert Moderator MVP
See if this tutorial (Example Filtering on a Form) helps with the concepts Doug. It should.
May 5 '08 #2
dougmeece
48 New Member
Thank you. I will check it out and let you know.

See if this tutorial (Example Filtering on a Form) helps with the concepts Doug. It should.
May 5 '08 #3
dougmeece
48 New Member
Hello NeoPa,

I looked at your code and tried to make it work for my database but I was not able to do so. I am a long time removed from any code work (and that wasPerl) so I am afraid I probably did not follow it very well.

I would be happy to send you my database if you wnated to look at it. I hope it is not too screwed up right now.

Thanks,
Doug

See if this tutorial (Example Filtering on a Form) helps with the concepts Doug. It should.
May 5 '08 #4
NeoPa
32,568 Recognized Expert Moderator MVP
A kind offer Doug, but I'll take a pass on that one ;)

I will try to help if you can provide a specific question ("My thing doesn't work - please fix it" isn't).

I'm happy to help you along, educating where possible, but if the questions are not specific enough it's just doing things for you which doesn't help you much in the long run, and takes up much more time and effort on my part (which isn't sensible use of my time).

To make it clear, I don't want to be unhelpful, but I need something more precise to work with.
May 6 '08 #5
dougmeece
48 New Member
I understand. I was hoping you may look at it and advise me where I went wrong so I could fix it not fix it yourself. Sorry if that was unclear.

OK, so here is what I have...

I have a database that is being used to chronicle writings that have been sent to publishers and whether they have been accepted or not.

The first form is called CreatedWorks and is used to update an append query. This one works fine and updates as expected.

The second form is called Records_Search and is used for exactly what the name suggests.

I have two combo boxes on the second form to use as independent criteria to search on.

Combo box one is called CboTitleSearch and should be searching by the title selected in the combo box compared to the append query used for the search for all records of the specific title submitted to a publisher.

Combo box two is called CboPublisherSea rch and should be searching for all titles submitted to a specific publisher from the same append query (which should match the publisher name in the combo box).

Problem with the search:
I have tried setting the criteria in the query (Records_Search _Query) to only include the records where [Forms]![Records_Search]![Title] are equal to the records in the append query(Created_S ubmitted.Title) . When I run this query it runs but returns no data. If I take the Where clause out of the equation it runs but obviously returns everything in the append query.

I have tried setting this up in the Records_Search_ Query itself without success. I have also tried adding an If statement (If [forms]![Records_Search]![Title] = (Created_Submit ted.Title) Then DoCmd.OpenQuery stDocName, acNormal, acEdit) to the code directly which also has not helped. If there were no matching records then I was trying to get a msgbox to display that.

How can I limit the data returned to match only what is displayed in the combo box when the search records command button is pressed?

I am sure I am doing something entirely idiotic here but like I said, I am far removed from coding and have lost practically all of it. I know what I want to do but I don't know how to get there. I tried to use the example you created but I just could not get it to work. I was able to follow what you were doing but I could not apply it to my work. I'm sorry if you get frustrated trying to help me but please know that I come to this forum only after hours and hours and days of trying to figure things out myself using all resources available (help, manuals and Internet searches).

Thanks again for any assistance you can provide.

A kind offer Doug, but I'll take a pass on that one ;)

I will try to help if you can provide a specific question ("My thing doesn't work - please fix it" isn't).

I'm happy to help you along, educating where possible, but if the questions are not specific enough it's just doing things for you which doesn't help you much in the long run, and takes up much more time and effort on my part (which isn't sensible use of my time).

To make it clear, I don't want to be unhelpful, but I need something more precise to work with.
May 7 '08 #6
NeoPa
32,568 Recognized Expert Moderator MVP
OK Doug. You've got my attention.

I need one thing explained though before I can make much sense of all this :
You refer to forms based on, and updates applied to, an "Append Query" (Created_Submit ted?). These are impossible, so I suspect we have a terminology problem somewhere. Append queries cannot be used to return recordsets (unlike tables and SELECT queries for instance) so I'm wondering what you're meaning here.
May 7 '08 #7
dougmeece
48 New Member
You're right, I misspoke. The append query updates the Created_Submitt ed query which is the one I am using. I meant to say appended query.

OK Doug. You've got my attention.

I need one thing explained though before I can make much sense of all this :
You refer to forms based on, and updates applied to, an "Append Query" (Created_Submit ted?). These are impossible, so I suspect we have a terminology problem somewhere. Append queries cannot be used to return recordsets (unlike tables and SELECT queries for instance) so I'm wondering what you're meaning here.
May 7 '08 #8
dougmeece
48 New Member
I believe the problem is in my query, Records_Search_ Query, but I am not 100% sure. I call that query when I click the search button, however, I have been unable to get the desired expression to work in the query.

You're right, I misspoke. The append query updates the Created_Submitt ed query which is the one I am using. I meant to say appended query.
May 7 '08 #9
dougmeece
48 New Member
Well guess what. I just stumbled into a fix. It may not be the best way but it seems to work now.

Here is the SQL Statement in my query. I changed from trhe Created_Submitt ed query to the actual table and added the WHERE clause again. I don't know why it worked this time but I am not complaining.

Expand|Select|Wrap|Line Numbers
  1. SELECT Created_Submitted.Title, Created_Submitted.[Year Created], Created_Submitted.Submitted, Created_Submitted.[Submitted To], Created_Submitted.Website, Created_Submitted.Type, Created_Submitted.Accepted, Created_Submitted.[Date Submitted]
  2. FROM Created_Submitted
  3. WHERE ((([Forms]![Records_Search]![TxtTitleSearch])=([Created_Submitted].[Title])))
  4. GROUP BY Created_Submitted.Title, Created_Submitted.[Year Created], Created_Submitted.Submitted, Created_Submitted.[Submitted To], Created_Submitted.Website, Created_Submitted.Type, Created_Submitted.Accepted, Created_Submitted.[Date Submitted];
  5.  
OK Doug. You've got my attention.

I need one thing explained though before I can make much sense of all this :
You refer to forms based on, and updates applied to, an "Append Query" (Created_Submit ted?). These are impossible, so I suspect we have a terminology problem somewhere. Append queries cannot be used to return recordsets (unlike tables and SELECT queries for instance) so I'm wondering what you're meaning here.
May 7 '08 #10

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

Similar topics

3
4747
by: William Wisnieski | last post by:
Hello Everyone, Access 2000, I have a main unbound form with a bound datasheet subform . The subform is bound to a query that returns records based on criteria in the main form. The user then double clicks a row on the datasheet subform to open yet another form bound to a table . These two forms are linked by the field. So far so good.
3
2926
by: SJM | last post by:
I have a problem that occurs occasionally with a db for a undetermined reason which I would love to solve. I construct and append a series of 7 records to a table using ADO recordset. Each record represents a day of the week, and the code appends a record starting with Monday and finishing with Sunday. After appending the 7 records to a table I then refresh the screen and display the records in a subform for the user to edit. What happens...
3
1011
by: cassandra.flowers | last post by:
Hi, I was wondering if it is possible (Using access) to have a query parameter as a drop down box rather than a text box? e.g. typing as criteria for a query produces a box with a text box for you to enter the parameter. Can any body enlighten me on how to turn this text box into a drop down box? And whether it is possible?
0
1930
by: johnson_cy | last post by:
I am using Access 2000. My main form has a record source of a table (employeeTbl with key of . It is filtering the record results. My subform and mainform have the link child/link master set to and the source object is the subform. My subform record source is a query from another table (vacationTbl). FYI: I was filtering on the subform, but removed it and replaced with
1
3878
by: Regnab | last post by:
I've got a form where the user can edit the lookups available in the database. It consists of a list box of the various categories on the main form, a checkbox on the main form and a sub form which displays the lookup values in a datasheet format. When a lookup values is no longer current, the user can untick the "Active" box in the datasheet and it will disappear (requeries the subform's recordsource query). On the main form, I have the...
4
2080
by: Regnab | last post by:
I've got a form - "frmLookup" (with a subform) that works very happily on its own. The form has a list box, which when updated requeries the subform to display the appropriate results. The problem is that for the final user interface, I had planned to use a "frmDisplay" form which had a number of menu items and then depending on what the user selected, it would display the appropraite form in a subform beneath the menu items. I did this...
10
3673
ChaseCox
by: ChaseCox | last post by:
I am using Access 97 to build my Database. I would like when my query is run, to populate a graph from the results of the query. Currently I am using a form to populate the query, and the query is then displaying the resulting records into a datasheet view on a subform. It is the resulting records I would like displayed on the graph. The fields I want on the graph are Prod_Code and Claim_Date. Thanks for the help.
8
7513
by: olivero | last post by:
Hi group, Is there an easy way to make a form create the same set of fields dynamically, once for each record returned by a query? I have a query that's being called from a form and the results are displayed in a subform in datasheet view. This is nice, but I want a better (and more visually appealing) way to interact with the query results. Instead of displaying the results in datasheet view, I'd like each field in each row to be...
1
1854
by: aaronkm | last post by:
Hello thescripts and well met. I've recently been handed a new duty and have the joy of 'crash coursing' MS Access. Things are working well but I've ran into a problem that I can't seem to find an answer to anywhere. I have a main form that contains a subform(datasheet view) based on a simple query with one criteria prompt. It's returning the data just as I need it to, but once it lists the results of the query in the sub-form (say...
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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,...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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
7321
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
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
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...
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
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.