Have Subform Display Query Results With Command Button

Nov 13, 2014

I have a form with a subform (FindBuffer_Form) which I built from a Query (FindBuffer_Query) within the query criteria I have the following (Like "*" & [Select the main Batch Number] & "*")in order to search a particular number.

I want to be able to run the Query from a command button on the main form and have the results appear in the subform, If I have the Source object of the subform set to Query.FindBuffer_Query I get prompted twice to answer the Criteria before the form opens, after the form opens the subform is generated as per the search criteria.

Ideally, I want the form to open with no data in the subform run the query from command button and have the result in the subform.

View Replies


ADVERTISEMENT

Display Query Results In Subform

Oct 5, 2006

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?

Thanks

View 1 Replies View Related

Display Query Results In SubForm

Jan 28, 2005

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!!!

View 4 Replies View Related

Using A Command Button To Display A Table

Sep 3, 2004

Can I use a command button to display my table? If so, what code needs to be used?

View 2 Replies View Related

Forms :: Find Button - Message Box To Display No Results Found

Sep 26, 2013

I am not sure where to start or go about creating message box that would display "No results found" if my queries return no results. My search of the forums hasn't been fruitful.

I have created one form that has a text box and a button that works as a search function to run through the tables and displays the applicable queries. Currently, if no results are returned nothing happens. Preferably I would like a message box to display stating that there were "No results found". I would assume that the code would be associated with the "Find" button. Here is the VBA code as it stands, again, I haven't even attempted to add code for a message box.

Private Sub Find_Click()
On Error GoTo Find_Click_Err

If DCount("Heading", "Service Desk Manual Query") > 0 Then
DoCmd.OpenQuery "Service Desk Manual Query", acViewNormal, acReadOnly
End If

[Code] .....

Find_Click_Exit:
Exit Sub

Find_Click_Err:
MsgBox Error$
Resume Find_Click_Exit

View 7 Replies View Related

Display Search Results In Subform

Sep 22, 2006

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 2 Replies View Related

Forms :: Updating Form Properties Dynamically - Command Button To Display Mode

Apr 16, 2014

I have a single form which becomes either readonly or editable or addnew using a circular toggle switch. The toggle switch is activated by a command button and the caption of the command button is used as the display of the mode.

The SetAddModeBt is a separate command button that initiates the add mode. The problem is that various form or field properties when defined on the fly are not stored and they get lost when you open the form again. Look at the code below:

Code:
Sub tglEditBt_Click()
'-------------------------------------------------------------------------------
' Circular toggle button to change display mode of the form
' ReadOnly - Edit - Add
'-------------------------------------------------------------------------------
' On Error GoTo NotFound
Dim ForName As String
Dim strSQL As String
Dim FMode As String

[Code] ....

Here the first two cases fail when executing the last statement saying it is not supported.

View 5 Replies View Related

Command Button For Subform

Sep 8, 2006

First let me say, I am sorry for all the questions lately. I thought once I got to the forms part of my database it would be smooth sailing boy was I wrong.

Anyways,

I have a form called Contractors and a Subform called ContractorsSubform. I need to add two sets of buttons one for the main form and one for the subform. Since I figured the subform is the hardest, I am working on that first. So here is my question:

I have an Edit Order Details button which works fine for the subform. I am trying to add a save Order Details Record button for just the subform (along with a message box asking if they are sure they want to save) however, I can't get it to work for the subform. I have tried various codes that I have found on this forum as well as in the help in Access and I keep getting errors. Can anybody help? I have attached the database to be looked at.

Tracy

P.S. I am not very good with VB but I am trying to learn.

View 14 Replies View Related

Command Button In A Subform

May 5, 2005

I am very new to Access and I am teaching myself.

I have the following situation:

1. Organizations form. This form has a command button that when
pressed it shows all contacts associated with the organization.

2. List of Contacs Form has a subform (Contacts) which has a Command Button that
is supposed to show all Calls related to a particular Contact.

3. When I press the Contact Command Button from the Organizations Form I get my Contact List with no problems
but when I click on the Calls button in the Contact Subform I get an "Enter Parameter Box".

4. If I use the subform as a regular form the command button works fine.

What am I not doing right?

Susan

View 3 Replies View Related

Main Form To Display Results In Subform

Oct 14, 2013

I have a main form which displays the results in the subform.

My requirement :

I have 1 main form and 2 subforms in that form.

I just wanted to have a get focus function on my 1st subform and needs to display the focusing result in the next 2nd subform.

In Detail :

I had a main form of search boxes Author, Published, title

If you search for 1999 in published text box then it will display all the results whose published year is 1999 along with those respective Author and Title in the 1st subform

In the result 1st subform if an ID is selected by the cursor then that entire row needs to be displayed in the next 2nd subform (As of now I wanted only 2 column details of the focussed result).

1st subform needs to display all the searched results (It was done and it works fine)

2nd subform needs to display the selected results (On Focus) of 1st subform.

How to deal with the 2nd subform linking up with the 1st subform.

Attached is the file. How to proceed further in getting done with the 2nd subform.

MForm is the main form and Main is the main table

View 7 Replies View Related

Add Command Button To Update Subform

Sep 27, 2006

hi guys i have a main form with a subform. i have created an add command button to add rows in the subform. (it could only add when the record count is less than 3). here is my code

If Me.SubFormName.Form.RecordsetClone.RecordCount >= 3 then
Msgbox " You can only add three"
cancel=true ' cancel event
me.SubFormName.Form.FieldName.SetFocus ' Set the focus to the field
exit sub
End if

i get no errors, However my problem is that it puts the focus on the begginning of the subform, i wanted to go to the end of the subform or new row... right now i have to go mannually until the last row... is there anyway to put the focus on the last row?

:rolleyes:

View 4 Replies View Related

Using A Command Button To Duplicate A Subform

Jul 12, 2006

Hi,

I am by no means an expert... probably demonstrated by this question:

I am trying to use a command button to duplicate the contents of a subform within that subform box. There are five fields that I would like to appear below the five already in existence when the command button is clicked.

Does anyone know how to accomplish this?

Thanks!

View 2 Replies View Related

Unique Subform From Command Button

Jun 8, 2007

I'm using Access 2003 and need to create a subform that is unique to each record. In other words, a command button on every record will open a subform with data specific to the record that the command button is associated with.

I've done this a long time ago, but having a brain fart on Friday afternoon. I need this for Monday morning (of course).

Thanks!

bugleboy62

View 5 Replies View Related

General :: Main Form Which Display Results In Subform

Oct 14, 2013

I have a main form which displays the results in the subform.

My requirement :

I have 1 main form and 2 subforms in that form.

I just wanted to have a get focus function on my 1st subform and needs to display the focusing result in the next 2nd subform.

In Detail :

I had a main form of search boxes Author, Published, title

If you search for 1999 in published text box then it will display all the results whose published year is 1999 along with those respective Author and Title in the 1st subform

In the result 1st subform if an ID is selected by the cursor then that entire row needs to be displayed in the next 2nd subform (As of now I wanted only 2 column details of the focussed result).

1st subform needs to display all the searched results (It was done and it works fine)

2nd subform needs to display the selected results (On Focus) of 1st subform.

How to deal with the 2nd subform linking up with the 1st subform.

Attached is the file.

View 4 Replies View Related

Forms :: Command Button To Add New Record In Subform

Nov 5, 2013

I am designing a database to manage hospital patient data. I will have to enter info at various points, e.g. when a patient is referred, admitted, discharged...

So for example, I have a main form with the patient's name and two subforms, one with the referral details (e.g. date, name of referrer...), and one with the admission details (e.g. date, diagnosis). They are linked through Parent-child links to the main form by PatientID. So, when I enter a new PatientID in the main form, the ID in the subforms is automatically added/synchronized.

However, I would like it not to be...since not all patients that are referred are then admitted. Therefore I would like to have a command button in the main Form that allows me to control when a new patient record is added to the admission subform. In other words, I would like an "Add a new Record in the admissions subform" button, which then creates a new record, with matching PatientID in the admissions subform (and in the related table). Is this possible???

I have tried using the command button wizard but it either requires a record to be already present in the subform, or it takes me to the first record of the form, and not the matching PatientID one.

View 7 Replies View Related

Forms :: SubForm To Display Test Results In Date Order

Oct 7, 2014

I am having an issue with the sort order on a subform.

Basically I have a main form with Client Details and a subform hich displays the associated test results for this client. Each client can have multiple test results which should be displayed in date order.

Initially the form was based on the table 'TestResults' and I set up the form with the Orderby property set to the field 'TestDate' and OrderByOnLoad set to True. This didn't work and the records were displayed in random order.

Next I tried setting up the form based on an SQL query with the field 'TestDate' sorted in Ascending order - same result. Tried this with OrderBy and OrderByOnLoad both set/unset as a pair and individually - always the same result.

How can I get the subform to display the test results in date order?

View 2 Replies View Related

Forms :: Command Button In Subform Continuous Form Not Working

Mar 17, 2014

I have two command buttons in a subform "sbfScoutRegDetails", one that launches a report and the other attaches the report pdf to an email, associated with the record ID when clicked.

Both of these buttons work fine when just the subform itself is open, but when viewing it in its main form, I get a window saying 'enter parameter value' for "Forms!sbfScoutRegDetails!ID" (this is the WHERE condition in the macro).The report then opens with all the record information blank.The full WHERE condition

Code:

[ID]=[Forms]![sbfScoutRegDetails]![ID]

Not sure if it's because of using a continuous form as a subform? I need the user to be able to view/print or email a contract to each group/contact that signs up.

View 5 Replies View Related

Forms :: Control Form Command Button Based On Subform?

Sep 2, 2014

i have some command button and some combo box on my form and also a subform. the subform contains some field. the fields used to enter numeric values.

i need to disable my command button on the form based on the subform fields if they r null.

View 1 Replies View Related

Forms :: Command Button To Populate Unbound Text Boxes From Subform Only Works Once

May 22, 2015

I have a tabbed form from which the user can select a contact's record from a subform on the first tab, click a edit command button, and the unbound text boxes on the top of that tab populate. The user can then click the second tab with employment history which has blank unbound text boxes and another subform which is linked by the contact id to the first tab.

The user can select a record in the second tab, click a command button and the text boxes populate no problem. The problem comes when the user changes the contact on the first tab, and then tries to edit a record on the second tab. Then I get a run-time error '-2147352567 (80020009)' saying the value you entered isn't valid for this field. Why it would work the first time by not the second?

View 7 Replies View Related

What Macro Command To Use To Close Query Results Screen

Apr 19, 2012

Am working with Access 2007. I have built a macro that opens several make table queries and exports the tables to excel spreadsheets. Macro functions properly, however the query results still show in the access database screen. What macro command can I use to close these screens after the action is done? I use the CLOSE command for each query but the results still show in the Access window.

View 2 Replies View Related

Display Query Results

Nov 18, 2005

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.

Thanks

View 1 Replies View Related

Display Related Query Results Together

Aug 7, 2007

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:

tblProducts
ProductID
ProductName

tblTests
TestID
TestName

tblSamples
SampleID
ProductID
TestID

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 2 Replies View Related

Doubleclick Field To Display Query Results

Sep 5, 2006

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 2 Replies View Related

Display Query Results On Form Via Text Box

Aug 27, 2004

Hi,
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
Tigrou

View 3 Replies View Related

General :: How To Get A Text Box To Display Query Results

Feb 24, 2013

I have a text box, I have pasted this into the control source:

=[qryIndividualFaultVolumes]

then on a button I have this code:

me.qryIndividualFaultVolumes.requery

However, I get a Method or data member not found error when i click the button?

View 3 Replies View Related

Forms :: Display Query Results In A Form

Jul 25, 2014

I am trying to allow end-users to only use buttons to navigate and display records in my database (so they don't know access is in the background) I have query that runs when they press a button but after they run it there is no way to get back to the main interface screen i.e. there is not a place to put another button and close the query. I was looking into creating a form to display the query results in datasheet view but it is not appearing the way I want. I inserted a subform and the results got better but I also do not like the way it displays because the user can see the subform, simple solution to get my data to display in the form so a user can view the results similar to datasheet view?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved