Queries :: User To Define Query Parameters Through A Form

Oct 18, 2013

I have a query and a form, and what I want to be able to do is have the user type in within the form the parameters for the query.

The part of the query that will hold the parameters is based on an amount (formatted as Currency), but I want the user to be able to enter >10 , =<100 or >100000 and get the correct results.

I have already set up the query and the form with unbound cells which are then referenced in the query I've tried just one cell where the user would enter >100000 or tried two cells where one cell would be for >,< etc and one cell for the value (which is formatted as currency), but that didn't work either.

The idea is that you enter the parameter and value then click on a button that runs a macro to export the query based or the user parameters, but everytime I try it I get a box appearing saying Property not Found.

View Replies


ADVERTISEMENT

Queries :: Table Of Companies - Allow User To Define Field On A Form

Feb 14, 2014

I have a table of companies, with fields that contain data for 2008, 2009, 2010, etc.

I'd like to design a query that allows the user to define on a form the field, or the year, they want to query. (by text string or some other way, I am good enough with the VBA that I can figure this part out once the beginning part is figured out)

I want 2009 data, I type in 2009 and get 2009 data from a table with many years' worth of data. But I only need one query for all the years.

I notice that this is easy with reports, just use SQL in the the wherecondition, argument, but I can't find the equivalent for queries. I tried putting the text field from the form in the SQL in the query, but could not get that to work.

View 3 Replies View Related

Multiple User Specified Parameters For Search Query?

Mar 30, 2006

Hello

I have created a database for my department to log all of our jobs to keep track of them and I want to create a simple search for them but I am having difficulties.

I am familiar with creating queries to search tables for matching records, but is it possible to get search criteria from the user (ideally from a search form they fill in) to form the query?

For example, I would like the user to be able to query the jobs by month and/or business area and/or supplier...is this possible?:confused:

Any help gratefully received!!!
:)

View 2 Replies View Related

Queries :: Query Asking For Parameters?

Dec 1, 2013

I have a query that pulls information from two tables. Some of the fields that are being queried share the same name in the tables, [Reimbursed_Amount] and [Cancel_Fee] specifically. In Design View I have specified that I only want the query to pull these fields from the Event Information table. An error occurs when I try to run it, saying that I need to define which table the field is from in the SQL code.

But then after I added clarification in the SQL, when I run the query it now prompts for a parameter for each of these fields. Why is this happening? I leave it blank, so a parameter has no impact on the query. How can I stop this?

Here's the SQL, after I added the table clarification:

Code:
SELECT (Sum(nz([Program_Cost])+nz([Millage_Fee])+nz([Auditorium_Cost])+nz([Cancel_Fee].[Event Information])-nz([Reimbursed_Amount].[Event Information]))) AS Total_Cost, [Shared Billing Information].Paid, [Shared Billing Information].Shared_Billing_ID, [Event Information].Shared_Billing_ID
FROM [Shared Billing Information] RIGHT JOIN [Event Information] ON [Shared Billing Information].Shared_Billing_ID = [Event Information].Shared_Billing_ID

[Code] ....

View 7 Replies View Related

Passing Parameters From Form To Queries

Mar 23, 2006

Good Afternoon,

I am trying to create a form where a user will enter in a value into a text field. Afterwards, when the user clicks "Enter", a query will run and will LOOK FOR THE VALUE THAT WAS ENTERED INTO THE TEXT FIELD. i.e.
User enters their address into the field and clicks the enter button.
Afterwards, a query will run like
select * from customers where address = @address <== the value the user entered into the text field. This is where the mystery lies. How do you pass values?????

Thanks,
Nervous Jervous

View 6 Replies View Related

Queries :: Parameters To Query String

Aug 15, 2014

Do access VBA implements parameters passed to query strings in all following parameters?I've been working in ASP.NET/Razor C# and this would be an example of how it would be done:

Code:
db.Query("INSERT INTO threads (name, date_of_creation, user_id, area_id, user_group_id)" +
" VALUES(@0, @1, @2, @3, @4)",
Request["txtThreadTitle"],
DateTime.Now,
Session["user_id"],
area_id,
0
);

View 6 Replies View Related

Queries :: If Statements To Set Parameters In A Query?

Jul 25, 2013

im working in MS Access 2007.what im trying to do is have a query run specific parameters if a check box is selected. So if the check box is selected than the query filters the "Tranche" column so that the only records that shown are records that have the "Tranche" coloumn = 1.

I know this can be done either in vba code or in the criteria section of a query but i dont know that appropriete language for either.

In vba code i was able to get this far. But..... i dont know how to call the criteria line from a query?

This is my very simple unfinished code.

My query is called [Tranch Query] and the column i want to filter with is call [Tranche]. The check box is called [Check0].

Private Sub Check0_AfterUpdate()
If Check0 = True Then
'How do i set the query criteria?????
End Sub

View 8 Replies View Related

Queries :: Access Query Parameters With Hyphen?

Jun 9, 2013

I have a table field that contains a lot of part numbers in different format. One could be with hyphen while others are without hyphen.

record#1 : 4535-300-34567
Record#2: 453530034567
Record#3: 4535-301-56721

In this case record# 1 & 2 are same part number only difference is hyphen.

I want to set my query parameter [Enter part number] such a way, when some one enter 453530034567 it should pull both the record (record#1 & 2).

View 5 Replies View Related

Queries :: Query Based On Banding Parameters?

Apr 6, 2013

I have a fact table which contains a list of products at many different Retail Prices. I want to band these products into groups based on Retail Price Bands.

I have created a second table with the fields Retail Price Band, Minimum Retail Price, Maximum Retail Price. This defines the banding structure.

I would like to join Retail Price with Retail Price Band based on the parameters in the second table but don't know where to begin.

View 3 Replies View Related

Queries :: Adding Parameters To Count Query

Sep 16, 2013

iwhen i add a field to allow me to add the parameters for a search between to dates. the query will only count the ethnicity of people who complained on the same day and give the others as a single number. i need to allow the user to search between dates as to generate the data for a report.

View 3 Replies View Related

Queries :: Exporting Query With Parameters To CSV Template

Feb 9, 2015

I have a template csv file which has comes with headers. I now need to export multiple datas from my different tables into the csv file. I thought I would open an instance of excel, open the query as recordset (in VBA) and go through each record and finally use appExcel.saveAs as a CSV file. The approach doesnt look like it will look. I have looked into the DoCmd.Transfer text method but I cant seem to create a export specification because my query requires two parameters (startDate and endDate).

Secondly it is a huge template, over 700 fields and I will only be exporting around 40 fields so there will be huge number of empty fields. If this was a excel file, I would write few queries and write result from one query into the file then skip required columns and then write results from another query but I don't know if its possible with Docmd.write txt.

I am using access 2013 (Office 365 Pro) to perform all of this.

View 10 Replies View Related

Queries :: Query With Daily Fields Based On Parameters?

Feb 11, 2014

I am trying to create a query that will provide a field for each day of a month. However, I want the query to be able to work for any month that I want to run on based on a parameter. Basically I want this:

Day 1: Sum(IIF([ReleaseDate]=#[# of Month]/1/[# of Year]#,[GamesSold],0)
Day 2: Sum(IIF([ReleaseDate]=#[# of Month]/2/[# of Year]#,[GamesSold],0)
and so on for 31 fields.

This is not currently working.

View 8 Replies View Related

Queries :: Using Controls From Separate Forms As Parameters In Same Query?

Mar 28, 2014

I have 3 forms that all use the same sub form. The 3 main forms show 3 different project types, where the sub form shows what other projects that a company is engaged with. Rather than create 3 different queries for my sub form, i would like to just filter it using criteria that looks at the CompanyID field on my 3 main forms. Currently my criteria is like this:

[Forms]![frmProjects_Detail_IND]![txtcompanyid] Or Like [Forms]![frmProjects_Detail_CSS]![txtcompanyid] Or Like [Forms]![frmProjects_Detail_TAP]![txtcompanyid]

Is there a way to ignore the parameters that are null?

View 3 Replies View Related

Queries :: How To Refer To Parameters In Navigation Forms In A Query

May 20, 2013

I did a query which parameter is written in a text box - tprj. This text box is in a form, which is in a navigation control, which is within another navigation control. How can I refer, in the query, to this text box?

The navigation forms are nmain which contains nprojects.

nmainsub and nconsultprojects are the navigation subforms
fprjconsult is a normal form, which is inside nconsultproject

I tried the following criteria:

[Forms]![Nmain].[form]![nmainsub].[form]![nprojects].[form]![nconsultprojects].[form]![fprjconsult].[form].[text4]

And

[Forms]![Nmain].[form]![nmainsub]![nprojects].[form]![nconsultprojects]![fprjconsult].[form].[text4]

And

[Forms]![nmainsub]![nconsultprojects]![fprjconsult].[form].[text4]

And

[Forms]![Nmain]![nmainsub]![nprojects]![nconsultprojects]![fprjconsult].[form].[text4]

And other forms too but I can't get it right.how to refer to forms inside navigation forms, inside navigation forms, in SQL? What are the rules for writing it clearly?

View 5 Replies View Related

Queries :: SQL Code To Define Field Format - Mismatch

Dec 1, 2014

I have created an union query to pull together the same data from 2 ODBC tables (seperate countries).As there is a clash in the client number I have added a "N" prefix to differentiate NZ from Australia, as below:

The problem I now have is that I get type mismatch when linking to another table. How could I change the SQL below to dictate the field format to number (providing it will accept the "N" prefix) or all to text?

SELECT dbo_ClientMaster.ClientNumber, dbo_ClientMaster.Name, dbo_ClientMaster.AddressLine1, dbo_ClientMaster.AddressLine2, dbo_ClientMaster.AddressLine3, dbo_ClientMaster.AddressLine4, dbo_ClientMaster.TradeCode, dbo_ClientMaster.ReviewLimit, dbo_ClientMaster.ClientStartDate, dbo_ClientMaster.TypeOfTrade, dbo_ClientMaster.NextReviewDate, dbo_ClientMaster.LastReviewDate, dbo_ClientMaster.TerminationDate, dbo_ClientMaster.TerminationReason, dbo_ClientMaster.BankSortCode, dbo_ClientMaster.BankAccountNumber

[code]....

View 2 Replies View Related

Queries :: Form Setup - Allow Users To Select Parameters Using Combo Boxes

Apr 3, 2014

I'm wondering is it possible to create a multiple parameter query which will return results even if you leave some of the parameters blank ?. I'm trying to set up a Form which will allow users to select parameters using combo boxes but at the moment you need to fill them all in or you'll get no results...

View 10 Replies View Related

Form To Set Query Parameters

Sep 11, 2006

I have created a form with multi-select list boxes, behind which is the following code to transform the users' selections into query parameters.


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("Test")

If Me!lstAB.ItemsSelected.Count > 0 Then
For Each varItem In Me!lstAB.ItemsSelected
strCriteria = strCriteria & "Centres.[Area Board] = " & Chr(34) _
& Me!lstAB.ItemData(varItem) & Chr(34) & "OR "
Next varItem
strCriteria = Left(strCriteria, Len(strCriteria) - 3)
Else
strCriteria = "Centres.[Area Board] Like '*'"
End If
strSQL = "SELECT * FROM Centres " & _
"Where " & strCriteria & ";"
qdf.SQL = strSQL
DoCmd.OpenQuery "Test"

Set db = Nothing
Set qdf = Nothing

End Sub



I would like to allow the user to set, on the same form, which field they want the resultant data to be sorted by, preferably by having a tick box alongside each list box, which sets that field as the sort field. The form will obviously need to allow only one of these tick boxes to be selected.

Can anyone advise me on how to modify the above code to make this possible?

Thanks,

Gary

View 1 Replies View Related

How To Define This Query?

Apr 8, 2007

Hi

I need to define this query:

I have 2 unbounded fields : ShowMonth and ShowYear (Each field represent the month and the year of Date field)
And UserName field

I need to define query that shows the dates and the UserName accordding to ShowMonth,ShowYear and UserName field (Without SQL).

I will be happy if serious answers will be post

Thanks

View 3 Replies View Related

Query Parameters From A Form Text Box

Aug 19, 2007

Hi There,
I am trying to get a query to pull dates from a form to use as limiting parameters for a report. One of my forms has the user enter a range of dates into two text boxes (a from-date in one box and a to-date in another) as the range of dates they want to pull information from a table via the query. These dates are also used in the Title header of the report that is generated from the query information.
How can I get the query to use these dates in the text boxes, rather than having to use the "between / and" command on the criteria line of the query design?
If I just have parameter windows pop up and have the user enter the dates there, I can't use those dates for the report, or can I? Any help would be appreciated. Maybe I haven't explained this properly, if so, I'll try again if I've just confused you.

View 3 Replies View Related

Placing User-Defined Search Parameters In Report Header

Apr 11, 2014

I created a Access 2010 database query to allow a user to search a list of orders between 2 dates, and I created a form for them to use for this search.

Then I created a report for the search results to land on. What I want to do is have the 2 dates that the user provided be displayed in the header of the report.

I created a new Text Box and placed it in the header. In place of the "Unbound" filler that was there, I placed

"=[Forms]![frm_DateRange]![txtStart]".

I used the following steps to do this:

Clicked on the Text Box controlPressed the "Property Sheet" buttonSelected the "Data" TabPressed the "..." button next to the "Control Source EntryThe "Expression Builder" came upDouble-clicked on the database name in the "Expression Elements" windowDouble-clicked on "Forms", then double-clicked on "All Forms"Selected the rpt_DateRange" formSelected "txtStart" from the "Expression Categories" window.I did not select anything in the "Expression Values" window.

When I go to "Report View", and see the Text Box I added, but inside it, it just says "#Name?"

View 7 Replies View Related

Define A Rank In Query

Dec 27, 2007

Dear all
i have a trouble to define a rank in query, i have a table named SALES
like below

region PRoduct qty
jabar A 10
Jabar B 20
Jabar C 30

Jateng A 50
Jateng B 40
Jateng C 35

i want to give a result in my query like below

region PRoduct qty Rank
jabar C 30 1
Jabar B 20 2
Jabar A 10 3

Jateng A 50 1
Jateng B 40 2
Jateng C 35 3


anyone can help me???thanks

regards

martell

View 1 Replies View Related

Query Not Using Fields On Form Instead Asking For Parameters To Be Entered

Mar 15, 2007

I have created a query that will pull the price of a property into the cost field combo box on a booking order subform depending on the values of the start date and property number enter onto the same form.

The query gets the price from the property price table matching on the property no i've selected on the booking order subform and also the start date i've entered on the booking order subform which needs to be between the start and end date fields in the property price table.

Fields in the property price are property price no, property no, start date, end date and price.

Also the booking order subform is a subform on a booking form

This is the query i have created:
SELECT [Property Price].Price
FROM [Property Price]
WHERE (((forms![booking order subform]![start date]) Between [property price].[start date] And [property price].[end date]) And (([Property Price].[Property No])=forms![booking order subform]![property no]));

The problem is when i run the query from the cost combo box the query isn't picking up the fields on the booking order subform instead its bring up a seperate meesage box from parameters start date and property number to be enter.
Can someone give me advise how to make the query use the values in the fields on the booking order subform i enter before running the query. cheers

View 2 Replies View Related

Passing Parameters To A Query From A Form To Filter A Report

Aug 15, 2006

I would like to have a user enter a start date and an end date into two
textboxes on a form. The two dates will be used to query a table. I
would then like to print a report that was created from that query.

Here is the query created as a stored procedure:


SELECT Transactions.*, Hoods.*
FROM Hoods INNER JOIN Transactions ON
[Hoods].[ID]=[Transactions].[BoxID]
WHERE ([Transactions].[Date] Between [@StartDate] And [@EndDate])
ORDER BY [Transactions].[Date];


What would be the best way to pass txtStartDate to @StartDate and
txtEndDate to @EndDate in the VBA code of the form? How would I open or
print the report created from that query filtered on that date range?


Any suggestions? Am I going about it wrong? Should I have created the
report from the above query, or should I do it another way? Can anyone
direct me to some code that does all of the above or something
similiar?


Thanks.

View 14 Replies View Related

Pre-Define Query Based On Input Data?

Apr 21, 2014

I am looking to find out if I can build a "on the fly" pass-through query based on user predefined data.

Basically I am linking to a massive database. Access link to DB2 table. In order to make the system useable for the users they need to edit the query before it's ran. If not the query over the network takes around 5 minutes every time it's accessed and options such as filters and sorting are chosen. So if a user sorts one column and filters on another the query has now ran 3 times. Once to open, once to filter, and once to sort. That just took 15 minutes.

So If there is a way to build macro or form that asks them for specific information first and then modify's the query so that it only gets ran once that would be fantastic.

Example:Table has 7 fields/columns. Usually they will do 3 things. Pull back data from either a month or quarter. Then filter a column by it's content. Then sort by date of another date/timestamp column.

View 1 Replies View Related

Reports :: Navigation Form - Passing Query Parameters To A Report

Aug 4, 2014

I have a navigation form that will have 6-8 tabs. We were using about that many databases, but we are finally consolidating them into one. The result of us using so many databases has been the multitude of forms and reports that were necessary for each database prior to merging them together.

The problem: There will be anywhere from 12-20 (text boxes) that the user can use to search anything in our database. What we need to have happen, if possible, is for those search parameters to show up in the header of our report if they have text in them. If the text box is blank, it should not show up in the header of the report.

I have read how to to do the start/end date technique, but I do not know if that would work for what we are doing since the boxes would only show up if they are populated by the user.

View 4 Replies View Related

Forms :: Refer To Combobox On Subform Within Navigation Form In Query Parameters

Jun 6, 2013

There is a command button on my form that calls a filtered query. I'm filtering the query based on a combo box within the form using

[Forms]![frmAssignDwgs]![Combo15]

It works beautifully until I put the form as a subform in the Navigation Form I'm using. When I execute it from within the Navigation form, it errors out looking for [Forms]![frmAssignDwgs]![Combo15].

Is there another syntax I can use so this will still work from within the Navigation Form? Or another way to approach this functionality?

frmNavigation is the main navigation form
frmAssignDwgToPkgs is the subform that holds Combo15

I found another thread (which I can't link to since I'm new) and tried various arrangements of the following to no avail.

[Forms]![frmNavigation]![NavigationSubform] .[Forms]![frmAssignDwgToPkgs]![Combo15]

View 3 Replies View Related







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