Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS ACCESS & have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for

Display Query Results In Subform

If there's a post out there that addresses this, please point me in that direction as I've had no luck.

I have my queries listed in a table. On my form I have them listed in my combo box. The user selects the query they want and hits the command button "Run". I would like to show the selected query in a subform on the main form and then give the user the option of selecting another command button to export the query to Excel.

I thought it would be as simple as setting the recordsource of the subform to the query name in my combo box, but that doesn't work.

Current code to run query in separate window:

Command button "Run"
Private Sub Command9_Click()
DoCmd.OpenQuery Me.Combo2.Column(1)

Attempt at getting what I want:

Privat Sub_Command9_Click()
Forms!frmQuerySelection!sfrmQuery.Recordsource = Me.Combo2.Column(1)
or perhaps
sfrmQuery.Recordsource = Me.Combo2

Am I even close?


View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Display Query Results In SubForm
I have created a query with parameters keyed in from unbound textboxes on a form. Does anyone know of a way to display the results (queried) in the sub-form of the same form (main) the textboxes reside? I have the query set up to create a table but when I use that table (or the query itself) in the subform I get the error message:

"The database engine could not lock table "tablename" because it is already in use by another person or process."

This seems appropriate because I am querying for results, but is there any way to get the results of a query into a form, rather than the more common pop up datasheet? I have tried several macros to open and close the tables - queries - copied tables forms....etc, but can't get it to work.

Thanks, for any help, I have spent some time on this one!!!

View Replies !   View Related
Display Search Results In Subform
Hey all,

I did a search and i found a thread that seemed like it would answer my question but for some reason the attachment isnt working. :(

Okay heres the question..

I have a form and it contains 3 fields and 3 command buttons.
When i hit the command button it uses a query to display the results.
What i want to do is instead of having the results display in a new window, i would like it to display on the same form .. maybe on the bottom of it.
Should i use a subform or listbox/combobox..

Can anyone help me figure this out?

Thanks in advance

View Replies !   View Related
Display Query Results
When I query my database I want to return groups of records. The groups differ from one another based on one field (Employee ID) -- So one group with Employee ID# 1 may have 2 records and another group with Employee ID# 2 may have 5 records, etc. My question is: What is the best way to display these groupings and allow the user to scroll or navigate thru the different groups easily?
Any help is appreciated.


View Replies !   View Related
Display Related Query Results Together
I have been doing a lot of searching on the forums, and I can't seem to find an answer to my problem.

I have a form that uses a query to create an e-mail. This e-mail lists all of the different tests to perform on a sample of a product. My table set up is as follows:




The purpose of this is to send out a sample of a specified product and perform 1 to XX tests on it.

Currently, my query is giving these results:

Product Test
Product1 Test1
Product1 Test2
Product2 Test1
Product2 Test2
Product3 Test1

I would like for it to format the data like this:

Product Tests
Product1 Test1, Test2
Product2 Test1, Test2
Product3 Test1

Any suggestions on what I should do?

Thanks in advance!

View Replies !   View Related
Doubleclick Field To Display Query Results
Hi, can anyone tell me how to doubleclick on field (on a form) and it opens up a form that shows bounded filtered results. I have a sub form which has details supporting summary numbers. I want my user to doubleclcik on the currency field and the detail supporting that sum total, pops up automatically. Any help please? :confused:

View Replies !   View Related
Display Query Results On Form Via Text Box
I have created a form (Form1) based on a table (Table1) and also a Query based on this table (Query1). I calculate a field in the query (Expr1: [column1] + [column2])
Now i have created a text box on Form1 that should display Expr1.
I know I could also calculate the value directly via the expression builder, but I would prefer to simply display Expr1 from my query. Which is the syntax I have to use in the Expression Builder?
I tried "= [Query1]![Expr1]" but it does not work.
Thanks for your help

View Replies !   View Related
To Display Parameter Query Criteria On Report Even For Nil Results?

Need advise on how to display on my report the criteria that i had specified in the parameter query even if the result is nil.

How can this be done??


View Replies !   View Related
Scroll Bar To SubForm Query Results
I have a subform that is populated by query results. In the query i have a field called Discussion that is just a free form field where the user can input any information. On my subform the field is not big enough to show all of the data if it gets large. Is there a way to add a scroll bar to this field on my qery so it will appear on the subform so the user can scroll down if necessary to see more of the text in this field?

View Replies !   View Related
Displaying Query Results In A Subform

This is a Query / Forms question...

I have 2 tables setup with a 1 to many relationship, simialr to 1 Customer having 1 or more orders. I created a query to prompt for all orders for a particular customer. I then created a form based on this query - i.e. linked the query to a form.

Now when I open the form I am prompted for the customer id and when I enter this all of the results of the query are displayed in 1 form. However, this is not what I want. I would like the orders for the customer to be displayed within a subform on the actual form. In this way the customer details will static and I can cycle through the customer orders in the subform separately.

Is there any way I can setup my query to display the results in this way? I need the prompt for the customer ID. Or is there any way I can setup the form to display the results in the above way?

Any help would be greatly appreciated.


View Replies !   View Related
Display The Query's Result In Subform
I wish to print the result from query in a subform. In my main form, I had a textbox call 'year' which asking user to input a valid year. The query will have to find out all the records that are in that particular year, one year before and one year after. After that, it should display the result in datasheet form. Can anyone out there help me in this matter?

My second question is Can we use crosstab query in the subform?

Thank you.

View Replies !   View Related
Display Qry Results In Text Box
Hello Experts,
i have this small problem with my qry results not being displayed in the text box.

tbl Issues= status field and many other fields
tbl Status= Active or Closed

here is my qry
SELECT Count(Issues.Status) AS CountOfStatus
FROM Issues
GROUP BY Issues.Status
HAVING (((Issues.Status)="Active"));

I have tried typing this code on the control source of the text box
but it doesnt work.

All i want to do is display my results in a text box on a form.

Any help
Thanks alot

View Replies !   View Related
ListBox Display Results?
I'm using the following code to pull results from table: Project Updates

FROM [Project Update]
WHERE Date Between Forms!SelectDates.cboStartDate And Forms!SelectDates.cboEndDate;

How can I then display these results in a listbox on my form?


View Replies !   View Related
Queries- Running/Display Results?
Hey guys-
I have a database of properties for sale. I want to calculate the asking prices of each record (for sale) against the sold prices of all the houses in the same area. Area is defined as a numeric number, and each property has one assigned to it. My question is this-
I have a table of all the properties. Do I run the query and store the results in a specific cell in the table- and then use a form to display those results? Or do I run the query from a form and not store the calculated results at all? I will be adding/updating info on a daily basis, so these calculation results will also change daily. Obviously I am fairly new to Access and trying to figure out how to do this stuff. Using Access 2002. Either way, I assume i'll be using a form to display the results one way or another...

View Replies !   View Related
Display Multiple BE Table Results
:confused: I have 3 identical fe be database running each with a table called cars that has identical form values just obviously different data. I want to create a table or query to display all the results from these but whenever i try and make a query i cannot seem to work it out. Anyone got any ideas? :confused:

View Replies !   View Related
Display Results Between Two User Entered Dates
Is there a clean way to:

1)Take two user dates as input at run time, e.g by a calendar GUI selection, or even just a string

2) Then return all rows from a table where the value of the date column is between those two values?



View Replies !   View Related
Results To Subform

I've got a query which is run by a button on a form, i want these results to be displayed in the subform on the same page but as opposed to just coming up as a set of results, any pointers?

my next problem is going to be how to get the results from a number of different queries (1 at a time) to be displayed in this 1 subform.



View Replies !   View Related
Search Results To Subform
I am trying to create a search (find) from an unbound textbox that will link with a subform on a main form. I am not using a drop list because the number of records in my table don't make it practicle. Using the DoCmd.OpenForm command I am able to get the results I want, but I would rather have the results appear on the subform embedded in the main form. Any suggestions. Below is what I've muddled through to get my result on a seperate form.

Private Sub AcctLookupBtn_Click()
On Error GoTo Err_AcctLookupBtn_Click

Dim stSubName As String
Dim stSearchName As String
Dim stLinkCriteria As String

'SET VARIABLE TO frmSearchAcctSub
stSubName = "frmSearchAcctSub"

stSearchName = "*" & Me![AccountLookup] & "*"

stLinkCriteria = "[AccountNumber]Like" & "'" & stSearchName & "'"

DoCmd.OpenForm stSubName, , , stLinkCriteria

Exit Sub
MsgBox Err.Description
Resume Exit_AcctLookupBtn_Click

End Sub

View Replies !   View Related
Displaying Search Results Using Subform Or Other Control
Hi, I'm just wondering if it's possible to display the result of a query on a subform which does not have a relationship with any other table.

What I'm doing is creating a search form where a query is built from the users input (through combo boxes and text boxes) of what table, attribute and condition they want to search from. When they press the search button, I want the result to be displayed in a datasheet below the selection criteria

The first thing I thought of using to display information with was a subform, but I think the purpose of having the subform is so that it can be linked with a form. So, is there another control or way of displaying results. The results can come from any table.



View Replies !   View Related
Display Image In A Subform
I have developed a form which contains a subform. The subform contains a bound image for display. Think of a 'department' form with 'employee' records on the subform containing an employee photo. (Very standard stuff.) It used to work correctly but I must have inadvertantly changed something but cant find it.

The problem is that the photos don't display at all as I move through the department records - using the main form's navigation. I need to use the subform navigation to show any of the photos. When I get a photo to show for a particular department then I can navigate through all the employees in that department and their photos display correctly. (If I run the subform separately then the photos display correctly too.)

Any ideas?

The properties which seem to be relevant are

Bound Object Frame:
Display Type = Content
Update Options = Automatic
OLETypeAllowed = Embedded
Enabled = Yes
Locked = Yes
AutoActivate = Manual

Enabled = Yes
Locked = No



View Replies !   View Related
Subform Record Display
I have a subform that displays three records for a single day in datasheet view. I want to display the most recent 2 days' records (six total). Re-sizing is not working. I'm guessing there's a simple solution, and I've searched for a post dealing with this but no luck. How can I do this? Thanking you in advance.

View Replies !   View Related
Subform Field Display
Picture, if you will, an Internal Audit department of a community college system. Each audit project can cover one or multiple campuses. A project can have one report for the overall project or multiple reports, one for each campus. On the master record for the project, I have a check box indicating multiple reports. If YES then the record for each campus, displayed in a subform, should display the field for the report date for that campus. If NO, then the report date field on the campus records should be hidden.

I read somewhere that subform fields are actually loaded before the master form fields. Is that correct? If so, how can I read that flag on the master record and appropriately display or not display the campus level report field?

Thanks in advance. You guys and gals have never let me down. :)

View Replies !   View Related
Main Form(search Criteria) & SubForm(results) - No Joy
Hi guys,

Ive been working on this for a while now but cant get anywhere, could someone please give me some advice as Im really stuck on it. I have a form inside which a subform. The main form contains seach controls and the subform contains a a query in a datasheet view. (see attached photo).

When the user searches by reference number, the matching record should be displayed in the subform (datasheet view). At the moment I cant get this to work at all, it seems as though the two forms just arent linked as nothing happens to the subform. Is there something I need to do to connect the forms? Below is my search code, most of which I lifted from an search example offered on a forum. Im only trying to get it to work for one control so far, a text box, but even this is causing me great difficulty. If I could just get some kind of response form the subform Id be able to make progress but as of yet, no joy

Private Sub Search_Click()
On Error Resume Next

Dim sSql As String
Dim sCriteria As String
sCriteria = "WHERE 1=1 "

'This code is for a specific search where you will need to enter the exact string
'The source for this code can either be from a table or query
If Me![txtRefSearch] <> "" Then
sCriteria = sCriteria & " AND qrySearchVisaSub.Ref No like """ & txtRefSearch & """"
End If
If Me![Index] <> "" Then
sCriteria = sCriteria & " AND qrySearchCriteriaSub.Index = """ & Index & """"
End If

If Nz(DCount("*", "qrySearchVisaSub", Right(sCriteria, Len(sCriteria) - 14)), 0) > 0 Then
sSql = "SELECT DISTINCT [Ref No]from qrySearchCriteriaSub " & sCriteria
Forms![frmSearchVisaMain]![frmSearchVisaSub].Form.RecordSource = sSql
End If

End Sub

Could someone please help out a beginner? It would be mch appreciated


View Replies !   View Related
Display Issue In Continuous Subform
Please see attached pic. When I put the focus in some fields, the dividing line is chopped. In other fields, it's not. All controls are identical in format. If I copy a control which doesn't do this, and paste & replace one which does, the two controls simply swap their behavior.

Does anyone know why this happens and how I might prevent it?

Many thanks.

View Replies !   View Related
Display Icon In Each Record In Subform.
I don't know if this is the right place to post this but here goes.
How do you display an icon or image in a field in a subform in Access2003?
I tried inserting an image into a field with its data type set to OLE Object.
This doesn't work. I insert a bitmap or icon file (*.ico) into the table. When I open up the subform the field displays the word "Package" for Bitmap image".
Any help would be greatly appreciated
Thank you :D

View Replies !   View Related
Display Last Continuous Subform Record
Im sure this must be easy to do (but cant do it myself...)- how do I set a continuous form subform to display the last record when a new main form record is opened? Whatever I do, the continuous subform displays the first record and I have to scroll down to get to a new record, which is getting tedious.



View Replies !   View Related
Continuous Subform Display Order
I have buttons that enable and disable editing/adding information on a continuous form.

When you click add the form then is set to allowadditions and shows you the * record. Is it possible to have that display at the top of the list instead of the bottom? If not, what would be the best method to move the focus to the new record when someone clicks add?

View Replies !   View Related

Copyright 2005-08, All rights reserved