Modules & VBA :: QDF Not Getting Parameter From Referenced Queries / Form

Jan 15, 2015

I'm creating an amortization schedule database using Access 2010.

I designed it such that I'll input actual principal and interest amounts in tbl_LoanActivity when I get statements in. I'd like to be able to press a button to update forecasted principal and interest amounts, then later I'll add code to make a report pop-up.

I initially designed this with only one loan to see if I could make the thing work, and it did. I've since added another loan and made adjustments, and this is where I'm having an issue.

tbl_LoanActivity references tbl_Loans, which has interest rates and monthly payment amounts. Needless to say tbl_Loans is the RecordSource for frm_Loans, and as such has a field LoanID. I have two queries that need to reference [Forms]![frm_Loans]![LoanID]:

1) qry_LoanActivity_MaxDate,
2) qry_LoanActivity_withPrincipalBalance

I can run these 2 queries (individually) with a reference to frm_Loans.LoanID just fine. (Without that reference, forecasted principal and interest numbers are highly inaccurate.) I have a qdf append query (vba) to calculate forecasted principal and interest amounts based on the most recent principal balance (referencing queries above), and relevant data in tbl_Loans (InterestRate, and RecurringAmount).

So here's the problem: without the above queries referencing [Forms]![frm_Loans]![LoanID] the qdf runs, yet produces inaccurate numbers. With the above queries referencing [Forms]![frm_Loans]![LoanID], Access gives me a message "Too few parameters. Expected 1." If I take the qdf and put it into a standard query it runs just fine. I need this append query to be a qdf so it will loop until RecordsAffected = 0.

I've sterilized the data and attached the database. I was thinking this adjustment of adding the reference to [Forms]![frm_Loans]![LoanID] in the 2 above queries would work, but it seems like the qdf is not inheriting the parameter.

View Replies


ADVERTISEMENT

Access 2010 - Getting Form To Show Update Data To A Table When Two Tables Referenced

Jun 27, 2012

I have a form with two tables referenced. I am using the form only to update one of the tables. I am using the other table to pull a reference field. When I add my second table using the query builder, it makes it to where I can't edit/add in my form. I assume its because of the SQL insert statement, but I don't see this statement and can't find where it is to edit it. How to have the form only update one of the tables, while just using the second table as a reference for a field?

View 1 Replies View Related

Queries :: Using Datevalue As Parameter From A Form

Apr 23, 2013

In my QBE, I have a field call [startDate]

In my criteria, I am passing a parameter from a form.

Currently, I am using: DateValue([forms]![myForm]![txtStartDate])

From myFORM, the value of the text box is 3/1/2013

When I run the query, it runs as expected and returns all records with the 3/1/2013 dates.

But now I want to make it where if the parameter is null.

How do I change that criteria if that parameter I am passing is null from my form's textbox? I want it to return all records that have a null entry in the [startDate].

View 5 Replies View Related

Queries :: One Parameter Form For Several Query

Jul 9, 2014

I have always used parameter forms for inputing query/report criteria. However, they have always been for one query or report. However, all searches I have done for trying to use one form for several queries all I find is a simple response of "Create a form and then direct all the queries to grab the parameter from the form.". Sounds simple enough but I can never get it to work.

I have created a macro that runs 12 Append queries. I have also created a parameter form that has an unbound combo box. The combo box is fed by a query that gathers all the Data Dates for the user to select from. So if there are 24 different data dates then the combo box displays them all.

I tried creating a macro that first opens the form then opens the query, however, it runs the query before I can finish entering the criteria in the form. Then I just get a pop up of "You are about to append 0 records..."I have found several walk-throughs for having a query use a form to grab parameter, but have not been able to find one that shows you how to set up one form to run several queries.

I keep trying to find an answer, then give up and continue manually entering 12 dates for 12 queries when they pop up after running the macro. Now I need to create a macro that runs 24 queries and I don't want to have to go through 24 parameter pop-ups.

View 5 Replies View Related

Modules & VBA :: Open PDF From Form With Search Parameter

Sep 10, 2014

I have searched for bits of code to copy other people better than I, and had some success but I am failing to complete, so it is now time for me to visit you all. I am trying to open a PDF from a button on a subform. The location of the PDF is specified in a field. I want to open the PDF and search for a Member ID criteria also listed in a field on the Form.This is my code:

Code:

Private Sub Text12_Click()
Dim strPath As String
Dim Searchmem As String
strPath = [Notetxt]
Searchmem = [MemID]

[code]....

Adobe Reader reports "There was an error opening this document. The file cannot be found." but then opens the file (that's something).So it's the "search" bit that is the problem, and I cannot for the life of me get my search parameter to be used.

View 5 Replies View Related

Queries :: Parameter Query Using Form To Collect Data

Jun 24, 2015

I have a parameter query using a form to collect the data. I put LIKE and wildcard enclosing the parameter to bypass the criteria if the data box is empty. It works well. I have another parameter of date type that uses between two dates. How can I bypass the criteria if I leave the data boxes blank?

View 8 Replies View Related

Queries :: Parameter In Query By Two Separate Form Field

Oct 31, 2013

I want to set parameter in my select query with or function as in detail.i have two form with same field

1-with field A
2-With Field A

now i want to select data for a table .with a parameter select with Field A in form 1 or Field A in Form 2.How can i do it

View 5 Replies View Related

Queries :: Query Parameter Input On A Form (combo Box)

Jul 15, 2014

I have a table which holds information on audits that have been carried out on staff member's actions. The 'Supervisor' field is populated via a combo box which is linked to a separate table (tblSupervisors).

I am now trying to build a query to allow me to extract all audits that have been carried out on a specific supervisor - rather than the criteria to be [Enter Supervisor Name] and allowing text entry, I thought it would be better to have form that pops up with a combo box that is used to select the supervisor (from tblSupervisors);

So far:

- Form "Supervisor_Select" is created, and has a combo box that looks up from tblSupervisors

- Macros as specified in the instructions are created (Open Dialog, Close Dialog, OK and Cancel)

- Query is done, all bar the criteria expression on the desired field.

- Module is created as described in the instructions, and is called "Supervisor_Select"

I have tried putting the following in the criteria;

[Forms]![Supervisor_Select]![cboSupervisor], however I think I am missing the bit where the query opens the "Supervisor_Select" form?? Will this only work from a button where the on click event runs the 'Open Dialog' macro and then runs the query?

View 4 Replies View Related

Queries :: Form Still Prompts For Parameter After Query Deleted?

May 15, 2013

I had created a query that I was attempting to reference a text field in a form that was open when the query is run. It wasn't working and whenever I opened the form it would prompt for the parameter before opening the form.

I ended up deleting the query to try again from scratch. But the form still asks for the parameters whenever I open the form. Why is Access still prompting me for the parameters?

View 14 Replies View Related

Modules & VBA :: Combo Box Will Display Specific List Of Items - Form Asking For Parameter

May 5, 2015

I have the below code behind a form so that a combo box will display a specific list of items based on the data in another combo box on my form.

I have two copies of this same form for two different departments. One of the forms works like a dream. However, when I copy that form, change the name, and update the code as pictured below, the form is asking for a parameter FROM MY ORIGINAL FORM and will not requery the combo box. I can't figure out why...there is no reference to the original form in my VBA as you can see below. I tried deleting the form and re-creating it, I tried deleting the code and re-typing it to no avail.

Private Sub cmboType_AfterUpdate()
Me.cmboAction.RowSource = "SELECT tblStatusList.Status FROM tblStatusList WHERE (((tblStatusList.Department)=[forms]![frmInquiryFraud]![cmboType]));"
End Sub

View 4 Replies View Related

Queries :: Form To Select Parameter - Causing New Field In Query Design

Jun 16, 2015

I have a query with multiple fields that is being run off of 3 parameters (linked for selection in a form). The problem is, I wanted to enable a select all feature, so I included a "Or ... Is Null" part in my criteria section, so that when nothing is selected, the query/report returns all records.

Okay so the problem is whenever I run the query with nothing selected for the parameter and then return to design view for the query, a new field has been created in the query design, titled with the expression I use to pull the parameter value from the form. This is frustrating because then that is causing errors in another report I run that pulls values from that query.

View 1 Replies View Related

How To Handle Multiple Null Values Using Form-based Parameter Queries

Nov 19, 2012

i'm creating a search form giving the end user a range of controls to use when filtering/searching data. See the image.But, i think my range search (using the textbox) to put in a lower and upper limit...is preventing this from working. In fact, when i put data into all the controls, no data pops up in my subform.

My query data source can also be seen...showing you how i've handled teh null entries. (i need to put in a null 'handler' for the two textboxes?)

View 2 Replies View Related

Referenced Image Issues

Sep 28, 2006

Hi,

I have a database where by users can input images. The database then copies the selected image into the current working directoryimages (c:dbimages as an exmaple) the it keeps a reference to the path in a table. When users then browse the records on the form I have an ImageFrame which looks up that path and displays the picture. This all works fine.

The problem I have is that sometimes the working directory changes. I then have problems with the previous images inputted as the tbale where the reference is stored is still pointing to c:dbimages. How can I can it so that rather than have a fixed path to c:dbimages the database will just looking in the current application directoryimages for the pictures?

Many Thanks,

View 2 Replies View Related

Tables :: Referenced ID Twice In Same Table?

Nov 2, 2012

use the same referenced ID more than once in the same table? I have a database for my stamps. The exact same type of stamp may be kept in more than one location (Album). So, I have TBL_Albums which has two fields "AlbumID" and "AlbumName". Can I use "AlbumID" in my main RecordSource "TBL_Main" more than once to reflect the different Albums this stamp may be found in without causing any major problems to the database?

If this is okay, I could then assign different alias names to each "AlbumID" column in "TBL_Main" such as Location1, Location2 etc to be able to tell them apart on forms etc.

View 13 Replies View Related

Help - Lookup Issues (looking Up A Referenced Field)

Feb 14, 2007

OK, Here is my issue:

CustomerTable:
PK:CustomerName

AgreementTable
PK:[Lookup]CustomerName from Customer Table:Agreement#

AddendumTable
PK:[Lookup] Customer Name:Agreement# from Agreement Table


So, Each customer may have more than one agreement.
Each agreement may have more than one addendum.

So when I create a table to create a new addendum, naturally I would like to link this to an agreement (which has already been linked to a customer). When I do the lookup wizard for the agreement field however, instead of being returned a list of customers, i get the PK of the customer and not the customer name.

How do I get the lookup to show the customer name and not the PK.

View 1 Replies View Related

Referenced Crosstab Query Does Not Always Have Information Required

May 11, 2007

My database is built using Access 97.

I have the following table and 2 queries:

Table: “Materials Master Sheet”
field: “Material”
field: “Re-Order Level”
field: “Re-Order Quantity”

Query (crosstab): “Most Recent Count Numbers”
field: “Material Name” (joined to table’s “Material”)
field: “Count Quantity”

Query (crosstab): “Orders Pending Delivery”
field: “Material” (joined to table’s “Material”)
field: “Total Orders”


I am attempting to create a query called "Count vs ReOrder" with the following fields:

1. “Material Name” - comes from “Most Recent Count Numbers” query

2. “Order” - if the inventory count has reached the reorder level point, then 1, else 0; criteria: 1
expression: IIf([Most Recent Count Numbers]![Count Quantity]<=[Materials Master Sheet]![Re-Order Level],1,0)

3. "Suggested Order" - reorder quantity - count of any orders pending delivery; criteria: > 0
expression: [Materials Master Sheet]![Re-Order Quantity]-[Orders Pending Delivery]![Total Order]


This works great if all materials have orders pending delivery. However, if there are no orders pending (material not displayed in crosstab query), the material is not displayed (even though, in reality, the suggested order should be >0)

Currently does this:
material 1 - count = 1, re-order level = 2, re-order quantity = 8, orders pending = 4: shows material and suggests ordering 4 (correct)

material 2 - count = 2, re-order level = 2, re-order quantity = 4, orders pending = 4: material not shown (correct, as suggested order would be 0)

material 3 - count = 2, re-order level = 2, re-order quantity = 4, orders pending = 0: material not shown (incorrect! should be shows material and suggests ordering 4)

How can I go about addressing the missing “Orders Pending Delivery” numbers?

View 2 Replies View Related

General :: Delete Employee From DB However Keep Referenced Records

Aug 18, 2014

I have a main table which records employee,date,record employee is related to tble employee. i want to be able to delete an employee however keep the referenced records with the name, date, record, is this possible?

View 3 Replies View Related

Can Fields In Access Tables Be Referenced By Number?

Jun 4, 2012

Do fields in Access Tables have a 'Number' property that you can use to reference them?

For example, if you have the following fields:

EmpID
FName
LName
Department
Hire_Date

Is there a way to query an employee's Hire_Date by telling Access to return the value that is in the 5th field [Hire_Date]?

[URL] ....

View 8 Replies View Related

No Unique Index Found For Referenced Field Of Primary Table?

Apr 12, 2013

I am trying a to build a slot booking database in which users will be able to book slots (ranging from 1-30) on a particular day for a specific site (location).

When trying to build the relationship between slot in tbl_available and slot in tbl_appointment i get the following error "No unique index found for the referenced field of the primary table" the same error pops up when trying to build a relationship between site in tbl_available and site in tbl_appointment.

I need both relationships to be 1 to many.

View 1 Replies View Related

Queries :: Crosstab Queries - Export Command Ask To Enter Date Parameter Twice

Feb 24, 2015

I have a crosstab queries which uses the date query parameters. However, when I go to my Export command (code is below), it ask me to enter the date parameters (start date and end date) twice. What do I have to do so that the system will ask me to enter once only?

Code:
On Error GoTo Err_cmdTest_Click
'Must 1st set a Reference to the Microsoft Office XX.X Object Library
Dim dlgOpen As FileDialog
Dim strExportPath As String
Const conOBJECT_TO_EXPORT As String = "qryEXPORT"

[Code] .....

View 9 Replies View Related

Tables :: Error - No Unique Index Found For Referenced Field Of Primary Table

Oct 8, 2013

I am trying to create a one-to-many relationship between these two tables. I want to be able to access the 3 fields on the [Processors] table within reports based on [AllItems]. [AllItems] is a listing of account activity where the [AccountNumber] repeats. I have every field set as the "Primary Key" on [AllItems] as that is the only way to avoid importing duplicate data. I am getting the error: "no unique index found for the referenced field of the primary table"

View 3 Replies View Related

Queries :: Access Multiple Queries Run With Date Parameter

Jun 19, 2015

I have 5 queries that I am running. The first query has the date range parameters set in the field area that I need to run and each additional create table query is based off the results of the previous query.

1. Which is better to use to run all of the queries in one simple step? A macro or a form? I am exporting the final table to excel so that I can make some additional adjustments off of it.

2. How would I setup the date range parameters for the first query if I were to use a macro without going into the query itself and updating the date field? I tried setting up a macro to run the queries by using the OpenQuery action for each of the 5 queries, but I cannot figure out how to do the date range.

View 11 Replies View Related

Queries :: Sub-queries With Text Box Based Parameter

Sep 18, 2014

I'm trying to perform a DELETE query at run-time. The criteria for deleting records is somewhat complex due to various one-to-many dependancies between the tables, overlapping of date fields etc., so in order to restrict the DELETE to only those records which qualify, I've set up a load of smaller queries to produce the list of eligible records.There is only one parameter required - a 'CutOff' date which is arbitrarily chosen by the user and is available in a textbox control on an open form when the code is triggered.

Here is the main DELETE query :

Code:
DELETE DISTINCTROW [tblComments].*
FROM [tblComments]
INNER JOIN [qryCommentsToPurge]
ON [tblComments].[CommentID] = [qryCommentsToPurge].[CommentID]
WHERE [tblComments].[CommentID] = [qryCommentsToPurge].[CommentID]

I've put qryCommentsToPurge and all the cascading sub-queries below - have highlighted in red where the parameter value is required (it is used in the queries to identify the records which must be retained, i.e. not deleted)Each of the individual sub-queries works fine and correctly (they return the correct population of records that they were designed to)If I run the sub-queries manually, I am prompted to provide the CutOff date, as you would expect - and the recordset returned in each case is correct for that date.

If, however, I run the DELETE at run-time (with the form containing that textbox open and containing a valid date value) I get a 3061 error :Suggesting that the queries can't pull the parameter value from the textbox on the form. But I've stuck a watch in the debugger on [Forms]![frmArchive]![txtCutOffDate] and I'm getting the correct date value? The form is open and available at the time.So why can't the query see it? I use these kinds of control references elsewhere in other queries and they work fine. I don't understand why it's a problem here?

Code:
SELECT [tblComments].*
FROM [tblComments]
INNER JOIN [qryIssuesToPurge]
ON [tblComments].[IssueID] = [qryIssuesToPurge].[IssueID]
ORDER BY [tblComments].[CommentID];

[code]...

View 1 Replies View Related

Parameter Queries Vs Parametrized Queries

Nov 5, 2004

I have been asked to set up a parameterized query using 4 fields (ID Number, Surname, Christian Name and Treating Dr/s). When I search Microsoft On-line under parameterized queries it gives a tutorial which basically set out a simple query with "prompt" parameters in the Criteria field. When I search under the Access Help it gives me a totally different explanation - ie. setting up a cross-tab query first and then defining parameters. Is this a loose use of terminology or is there indeed a difference. Help please!

View 1 Replies View Related

Parameter Queries

Jun 29, 2007

Is there a way to label a parameter in a query?

I need to enter a start date for a query - the parameter - and the end date is always six months later.

Currently, I use;

Between [Enter Start date:] And [Enter End date:], but this is not idiot-proofed.

How can I make the second parameter be a calculation based upon the first; i.e., [First Param] + 180 days?

Thanx for any help!

View 2 Replies View Related

Parameter Queries

Nov 15, 2007

Hi there.

I am looking to rationalise some of the queries I have in my access application.

Let's say I have two forms that query the same table based on a value they have in a combo box.

Currently I would have a separate query for each form and set the criteria to the name of the control on the respective form.

My question is whether I can use just 1 parameter query and use this for both forms, passing the necessary criteria - similar to how you would with an SQL Server stored procedure.

I have done this in the past programatically but wondered whether it is possible to do this within the GUI?

One solution is to not have any criteria in my query and then define an SQL statement in the rowsource of my form/control that queries my original query i.e.:
"SELECT FirstName, LastName from Qry_Customers WHERE QryCustomers.CustomerID = ????"

This works but it not as easy to maintain as having separate queries (same reason why I prefer to use stored procedures rather than definining my SQL statements within my code)

Also are there any negative performance impacts in defining the rowsource in this way (opposed to just setting to an existing Table/Query)?

Thanks,

View 1 Replies View Related







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