Choose Table In Parameter Query

Oct 23, 2005

Hi

I would like to set up a query that uses two tables. One of the tables, the 'main table', wil be used every time the query is run. Each time a new record is created in the main table a 'new table' is created containing a subset of data - the name of this table uses a ref ID from the main table. I would like to be able to select which 'new table' to use in the query as part of a parameter query.

eg. Main table record 1 has a field JID of J0001 and a corresponding 'new table' titled J0001. record 2 in main table has JID J0002 and creates a 'new table' J0002 etc

so I would like to set the query up such that when a record is chosen in 'main table' the query knows the name of the 'new table' corresponds to the JID of the record in 'main table' ....

Have seen the same question asked but no answer - is this possible ?

any pointers appreciated..

View Replies


ADVERTISEMENT

Parameter Query - Using Choose Function

Aug 24, 2005

I need to allow a user to select criteria as part of a query.

Running the query manually I would type in either:

"Core Stock"
OR
<>"Core Stock"

in the criteria field of the column.

I tried using the following parameter in the design grid:

Choose([Select 1: Core Stock 2: Not Core Stock : ],"Core Stock",<>"Core Stock")

The "Core Stock" option works but the <>"Core Stock" returns no records.

I would prefer not to use a form if possible . Any ideas ?
Regards

David

View 3 Replies View Related

How To Choose The 10 Latests Entries In A Table (from A Form)

Aug 10, 2007

I'll start by saying that I'm not sure which sub-forum to choose, as my question(s) covers several areas, so I have tried with this one first.

I'm currently making a database, which among other things contains a 'Port of Call list' table. I have a form, where I can add data to this table, meaning, that whenever a vessel has left its port, user can update following: Port name, security level, arrival date and departure date.

What I need is two things (it might be more or less the same):

1. When user click a "Generate" button on a form, the 10 latest port calls from the table, should be shown. I'm not sure what kind of control is the best to should the list on the form. Code is also needed.

2. I would also need to be able to print the list. It should be part of a report. Again which controls/which code to be used is needed.

I hope that someone are able to assist, as I have no clue what to do.

Thanks.

View 10 Replies View Related

Forms :: Using Checkboxes To Choose Data From A Table?

May 5, 2015

I have a table tblMessages, with a yes/no column called Available I have a form with three checkboxes chk1, chk2, and chk3 the when i click chk1 the other two check should be checked which this code seems to do but what it is not doing is going to the table and selecting the data where the ID is 2. what am i missing here?

Private Sub chk1_Click()
Dim strSQL As String 'Holds the SQL statement for this command only.
If chk1 = True Then
chk2 = True
chk3 = True
strSQL = "UPDATE'[Available]' FROM 'tblMessages' WHERE '[ID]'= 2"
Else
chk2 = False
chk3 = False
strSQL = "UPDATE '[Available]' FROM 'tblMessages' WHERE '[ID]'=2"
End If
Me.Requery
End Sub

View 4 Replies View Related

How To Choose Row Heading When Using Create Table Wizard

Sep 23, 2015

I am unsure of how to choose my row heading when I use the create table wizard. It gives me the option to use the first row but my row heading is actually row 17.

View 6 Replies View Related

Table Name As Parameter In SQL Query

May 23, 2006

I have a SELECT query which includes complex calculation that I would like to run on a large number of tables. This query also uses parameters to input ranges for some fields.

I can run this on other tables by doing a global replace of the table name in the script and pasting this as a new query, but this is cumbersome. I would like to set the table name as a parameter, so I can type in the table name for which I want the query to run (similar to the parameter inputs on the range fields).

Is there any way this can be done within SQL? I presume it can be done via VB, but I am not familiar with VB.

Any help appreciated.

View 2 Replies View Related

Use 1 Form And Choose From Which Query

Jun 2, 2005

Hi,
I have a requirement to filter some queries periodically on the date field.
What I want to do is create a form that lets you choose which query to use and filter and not create alot of single forms.
The filter will be only be applied whilst the form is open.

Cheers

Gordon

View 3 Replies View Related

Update Query To Choose Criteria

Mar 2, 2007

Hello, i was wondering if you could help.
I want to run an update query, taht updates prices in a table. But i would like to be able to choose the criteria when the query runs, for example a message box appears, that will allow me to enter a certain amount for the prices to change by. Could someone guide me on how to do this? thankyou, its much appreciated

View 3 Replies View Related

How Can I Have A Listbox Let Users Choose What Query To Run?

Jan 6, 2008

I want to have users be able to choose query "x" "y" or "z" from a listbox. Upon selection of query "x" "y" or "z" from the listbox, I want the query to run? I want to run this query from form "RunQueries" Does anyone know how I can do this? Thank you in advance for any suggestions, I appreciate all the help I can get

View 10 Replies View Related

Queries :: Using Choose Function In Query

Sep 28, 2013

I have an option group that lists a variety of categories which I want to query on.

I know that the option group only returns values.

In the Option Group, On Time = 1, Over Due =2 ,,,,

I am using a Choose function in my query. That is working fine. But ... I would like to have a last choice called "All" such that when selected all data is shown (i.e., On Time, Over Due, ....).

I am using the following:

Choose ([optiongrpStatus],"On Time", "Over Due", .... ,???) as my query criteria.

Have not figured what I can put in the last choice to get all data.

Tried "Is Not Null", tried "On Time or Over Due" - know these don't make sense -just wanted to try.

View 7 Replies View Related

Multiple Table Parameter Append Query

Oct 6, 2005

With referential integrity enforced, is it possible to use append query to append to multiple tables based on only one parameter that applies to only one table. If so, please enlighten me with a detailed explanation.

Thank you

View 1 Replies View Related

Parameter No Longer In Query After Table Update

Aug 10, 2011

I have a lot of tables that need updating often, so I delete the old ones and re-import them then run the queries again. From time to time, I add / remove columns but in the case I removed columns that are NOT needed in the queries.

So, I ran the queries again and they run fine but it says "Enter Parameter Value" for a column that is no longer there. It's not in the SQL code either.

So where is it trying to get these columns from and how do I fix this?

View 2 Replies View Related

Can I Dynamically Choose Which Fields Are Being Selected In A Query?

Jun 6, 2007

Is it possible to have a form designate which FIELDS to include in a selection query? I know that I can determine criteria and such, but i want the user to be able to generate a report based on the query select a, b, c from blah, or if they wish, just select a, b from blah...

View 5 Replies View Related

Modules & VBA :: Passing Parameter To A Query - Data Sent To A Table

Jun 5, 2013

I have a function that when called transfers a query recordset to an excel spreadsheet then emails it. At the end of the function I use code to write the date sent to a table. Each time the function is called I only need records in the query that have been modified since the last time the function was called. I have a field in the query 'LastModified' with a criteria '>[Enter Date]'. I then look up the date in the table and enter it manually. I know how to look up the last date sent in table using code but getting the >#SomeDate# in the query with VBA.

Code:
DoCmd.TransferSpreadsheet acExport, , "qryUpdateWebmaster", _
"C:SubmarinersUpdates_Sent" & fname & ".xlsx", True, "Webmaster_Update"

View 1 Replies View Related

Queries :: Parameter Query - How To Get Table Contents Between Dates

Feb 3, 2014

I have a parameter that I need to get a table contents between dates. In the query:

Birthdate: XXTable: criteria as follows: Between [Enter Start Date] and [Enter End Date:]

When run it gives me the Error - ! This expression is type incorrectly, or its too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables

I have tried almost everything. The formatting of the Birthdate is x/x/xxxx or shortdate. Will this affect the input thus affecting the outcome of the query.

View 4 Replies View Related

Cannot Run Multi-table Parameter Query With Criteria Specified In Form

Dec 7, 2011

I've created a farm database, with a form (frmSearch) that will allow user to filter data. The form comprises of combo box and list box etc... for the user to input their own criteria. The subform below has a datasource. The data source is based on a query (qContractionSearch) which is basically a parameter query with 3 tables. The problem is, however, that it won't work with 3 tables... but will work if data source comprises just one table.

See the farm database attachment...and go to frmSearch...then go to Contraction tab. (The Cattle tab filter works fine-it only has a single-table datasource).i have a requery macro which runs whenever the user clicks 'search'.

View 3 Replies View Related

Passing A Parameter In A Query To Update Linked Table?

Oct 8, 2015

I have a linked table tblHome which is stored in a Sql Server DB and I want to create a form with 3 fields in it i.e. fieldA, fieldB, and FieldC in it and a button.

I want to add values to fields fieldA and fieldB and fieldC and when I click the button I want the value in fieldA to update any records in the linked table tblHome which contains the values in fields fieldB and FieldC.

how to do this?

View 5 Replies View Related

Queries :: Adding Test Field To Different Table And Try Different Query Using Like Parameter

Mar 20, 2013

I'm using Access 2003...I have a query that searches a parts table by description:

Like "*" & [Enter in Part Description to search] & "*"

I need to add another search to this query, I added another field to the parts table call manufacturer. I add this field to the above query and added this parameter to it:

Like [Enter in Manufacturer] & "*"

I then added a manufacturer to one of the fields for test purposes. For some odd reason this doesn't work. If I take out the manufacturer parameter and don't enter in anything into the part description the query returns all the records. When i type a description into the part description field the query returns the proper records. When I add back the manufacturer parameter and enter through both parameters only the one record returns showing the test record instead of all of them. If I put a part description in and enter through the manufacturer parameter no records show when they should.

I've tried adding a test field to a different table and tried a different query using the like parameter. The parameter works in a field already in the table but won't work with the new field I added. I've done compact and repair.

View 6 Replies View Related

Queries :: Enter Query Criteria - Filter All Record From Parameter Table

Nov 14, 2013

I have table which store set of number

table: parameter
field: Branch
550
660
770
880

I want to use enter query criteria so that it can filter all record from parameter table, How can I do? or any VBA code can serve same purpose?

View 6 Replies View Related

Capturing Parameter From Parameter Query

Jul 12, 2005

I have a form whose data source is a select query, q3, that is built from 2 other select queries. I'll call them q1, q2, and q3. q1 is a parameter query where I enter a "Cutoff Date" that the 3 queries manipulte and generate the desired results that appear in the form. The problem is that I don't know how to capture the parameter "Cutoff Date" from q1 to display on the form.

View 2 Replies View Related

Parameter Query Asking For Parameter More Than Once!

Nov 9, 2006

Hi,

I have a query that requires a Start-Date and an End-Date to be input by user for the Where clause. It is asking for both over and over. I've had it ask from 1 up to 4 times! :eek: Shouldn't it store the input and only ask for it once? I'm thinking that the way my query is arranged may be causing it to have to loop through that section more than once to find the data, but that's just my theory. Any help would be great!

Here is my code (abbreviated slightly):

SELECT DISTINCTROW C1.*, C2.*
FROM Pen AS C1 INNER JOIN Jobs AS C2 ON C1.subno=C2.[Jobs Acct]
WHERE ((C1.typ="SS" Or C1.typ="CC" Or C1.typ="PP" Or C1.typ="TT") And C1.stdate>=[Enter Start Date] And C1.stdate<=[Enter End Date] And C2.[Type]<>"EE" And C2.[Type]<>"QQ" And C1.entdate<=C2.[ChangeDate]+60);

I'm selecting rows from "Pen" and "Jobs" that have the same subno/Jobs Acct numbers (text), then there are criteria for "Pen" types, user inputs criteria for date range (Start Date and End Date) and there are criteria for "Jobs" types. Finally, there's a cross-table criteria based on a date field ("Pen" entdate should not be more than 60 days past the "Jobs" ChangeDate). Tables are in quotes in my explanation here.

So running the above, it asks for user input "Enter Start Date", then again for "Enter End Date"...but then it asks for each again...and again...and sometimes again!

Help! :confused:

P.S..I didn't notice this repeating until I made it user input (parameter query) because it was using whatever dates I hard-coded in there before.

View 2 Replies View Related

Choose Higher Value

Aug 8, 2005

Hi,

Is there a way to automatically choose a value such as 0 if the expression goes to a negative number?

E.g. I have a query that will subtract a numeric field from 10. If 10 - [numericfield] is less than 0, then I only want it to display 0. Otherwise, it can display the value if it is positive.

Any help would be much appreciated.

View 3 Replies View Related

Choose Order By

Feb 19, 2008

Hi everyone,

I am looking for some help with a particular problem. I have a report based on a query and at the moment it is ordered by a particular column.

What I want to be able to happen is that the user chooses what they want the query (and subsequently) the report to be ordered by before they run the report by means of a combo box or something like that.

Is this possible in anyway?

Thanks.
Gareth.

View 3 Replies View Related

Using IIF Criteria To Choose Between Two Different Like Selects

Aug 26, 2014

I am setting up an Access database for a small school. The database contains a record per person. When we get a duplicate lastname field we set a family_id field to lastname followed by a number.

So for example the first Smith family needs to family_id. But the second Smith family gets a family_id of smith1. To select an ordered list of Families I need a query that will use the family_id if it is set and if not use the the lastname to collect family members.

My query uses a presorted table, CurStuByGrdTbl , of current students to produce the families directory by grade and alphabetized.

The WellSchoolCommunityAll table is the entire database. So if the student entry has a valid family_id, matching pattern "*#" then

I perform a Like with family.id otherwise I perform a Like with lastname.

This query gets me nothing, no records.

IIf(([CurStuByGrdTbl].[family_id]="*#"),[CurStuByGrdTbl].[family_id] Like [WellSchoolCommunityAll].[family_id],[CurStuByGrdTbl].[lastname] Like [WellSchoolCommunityAll].[lastname])

View 4 Replies View Related

Queries :: Attach Parameter To Table Name

Jul 10, 2013

I am trying to set up a create table query using parameter called Year. For each year I input , I need to create a new table with the suffix of the year. for example, if i input year 2011, i want to create a table called budget_2011, if i input year 2012, i want to create a table called budget-2012...

View 3 Replies View Related

How To Choose Field Based On Criteria

Jun 1, 2007

Hi,

I am building a database that calculates freight costs for shipments.

I have one table that has order data with fields such as [Order Number], [Origin], [Destination], [Service Level], [Weight].

The service level is one of 4 values: PRE 9, PRE 12, NEXT DAY, NEXT DAY +1.

The origin and destination use country codes such as BE, AT, CZ, PL for Belgium, Austria, Czech, and Poland respectively.

I also have rate sheets from carriers such as DHL and UPS and they provide their rates in the following format (numbers are made-up as real rates are confidential): [Origin], [Destination], [Service Level], [0 to 0.5 kg], [0.5 to 1.0kg], [1.0 to 1.5kg], [1.5 to 2.0kg], etc all the way up to 30kg. The rate is then in the appropriate column and the row gives the origin-destination-service level combination.

(sample freight rate table uploaded as zipped excel sheet in attachment)

I need to return the rate from the appropriate row based on the [Origin], [Destination] and [Service Level] fields (easy enough), which is easy enough.

The hard part is selecting the correct field to return. I tried usign a Choose expression but Access rejected it saying it was too complex (maybe because too many choices?).

So I'm stuck. And working towards a deadline... :-)

Can anyone help please?

Many thanks,
Martin.

View 1 Replies View Related







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