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()
Attempt at getting what I want:
Forms!frmQuerySelection!sfrmQuery.Recordsource = Me.Combo2.Column(1)
sfrmQuery.Recordsource = Me.Combo2
Am I even close?
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 ..re-opened forms....etc, but can't get it to work.
Thanks, for any help, I have spent some time on this one!!!
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
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.
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:
I would like for it to format the data like this:
Product1 Test1, Test2
Product2 Test1, Test2
Any suggestions on what I should do?
Thanks in advance!
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:
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
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??
I'm fairly new to MS Access, and this might sound like an extremely elementary question, but I have a form that has a textbox that user can enter a number and it hit run and it launches a query. I want to display the query results within the same form, rather than opening the query, is this possible? I've tried subforms, ole objects, other text boxes, but no luck... Any suggestions?
Is there a way to show the datasheet (results of a query) in a text box on a form? I have a form that has a combobox with the months. When you choose a month and hit the run query button, the query pulls all of the records for that month. There is also an email button that sends proofs of greeting cards for the chosen months. I want the datasheet from the query to show in a text box so that you can preview the results without leaving that form before hitting the email button and emailing the proofs.
I'd like to be able to display the results of a query in a MsgBox. Basically, I have a subform with CheckBoxes and I'd like to be able to display what BatchIDs have been selected. I can access the records I want via a query which shows me what has been selected, but I'm not quite sure how to get the results in a MsgBox.
Hey, I have 12 different queries which I need to sum the values of one of the fields in each query and display the results in a report.
-there are 6 sites,- each site has multple enteries. I want to sum the values of the hours worked field for all entries in that site that have Y for hours billable, and then in the row below, the same thing for N hours billable,
then below I want to total the 2 coloums. In the colum beside it I wish to do the same thing for the next site
Site 1 Site 2 Site 3 Site 4 Site 5 Site 6 Total
Billable Y 3 5 8
Billable N 3 5 8
Total 6 5 11
I need to know how to have the summed results of hte query appear in the table.
I dont know if it makes a dirrernce but the Query is a parameter query which updates on a form...
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?
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.
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?
Hello to all,
I've researched this issue myself both from the utter access database and the 'net but have had no luck. It seems to be a common problem but with no definitive solution.
I have a combo box that has as its record source a distinct list of Purchase order's from tblpo.
Below that is a subform.
When I click on a command button I want the selection made from the combo box to be passed into a query to return those results to the subform.
I have as the subform's record source a query that returns everything from the tblpo table.
The challenge comes in that the subform does not refresh when my command button is clicked. It does not display the results from the query until after the form is shut down and opened again.
I've tried using Me.refresh and me.subformname.refresh, as well as me.requery but havent had any luck.
Where exactly does the refresh or requery line of code need to go?
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
Set db = CurrentDb()
Set qdf = db.QueryDefs("qryporesult")
strCriteria = Me!cbolabpo.Value
'If Len(strCriteria) = 0 Then
' MsgBox "You did not select anything from the list" _
' , vbExclamation, "Nothing to find!"
' Exit Sub
strSQL = "SELECT * FROM tblLabPO " & _
"WHERE tblLabPO.labpo IN('" & strCriteria & "');"
qdf.SQL = strSQL
Set db = Nothing
Set qdf = Nothing
Any help would be appreciated. Thanks!
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
GROUP BY Issues.Status
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.
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?
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...
: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:
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?
I am looking to create a form in Access that will enable me to run many of my pre-made SQL queries at a click of a command button.
I dont require each results table to display its results all I simply want is a label displaying the figure that was returned. I have attached a simple image to try and explain what I mean.
I would be extremely greatful if somebody could point me in the right direction on the format of the code I require. As i am a complete coding novice and many people on here are pure genius im sure somebody will be able to assist me.
i have a form that i want to display a DLookup result in:
but i want it to be displayed in a label rather than a textbox (which looks like it needs data entry).
i looked in the label properties and didn't see a place to input a control source.
I was wondering how I can press my command button called "command" and when it calculates a value, display it in a text box.
I searched the database but I really couldn't find what I needed.
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.
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"
'SET VARIABLE TO WILDCARD + INFO ENTERED INTO TEXTBOX + WILDCARD
stSearchName = "*" & Me![AccountLookup] & "*"
'FIND VALUES THAT MATCH SEARCH CRITERIA IN ACCOUNT NUMBER FIELD
stLinkCriteria = "[AccountNumber]Like" & "'" & stSearchName & "'"
'OPEN THE FORM THAT MATCHES THE CRITERIA
DoCmd.OpenForm stSubName, , , stLinkCriteria
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.)
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
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.
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. :)
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.
I built a database to hold contact information about my clients. The tabbed form that automatically opens has a combo box at the top which allows me to select an individual client. While their e-mail addresses and physical addresses come up without a problem once I have selected a client, I am having trouble making the subforms on that tab display the records that they should. The database worked perfectly in Access 2003, and this is the only problem I've run into now that I've moved up to 2007. Interestingly, the subform on the second tab still works perfectly. All of these subforms are linked to the ID associated with each client. Any help that you could provide with making these other subforms show their data would be greatly appreciated!
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?
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