Retrieve Query Parameter?

Oct 19, 2005

I have a query and using a [text string] as criteria in the Design Window - when the query runs, entering the appropriate search string retrieves the appropriate results. I have created a form using this query as the recordsource - and as such the user is asked for the string before the form loads and the results are displayed.

Is it possible to retrieve the string the user entered and display this value on the form?

View Replies


ADVERTISEMENT

Query Cannot Retrieve Enough Fields

Feb 7, 2007

I'm trying to build a form based on a query to use for data editing/entry purposes.

The only way I can think of to do this is to use a query to get data that is particular to my specified customer.

The first problem I have run into is that one query does not contain enough fields to retreive all the fields in my table.

I figure, perhaps I have made a flaw in my design and shouldn't go further with this until I verify it to be true. I don't think I've made a flaw, but the fact that a query has limited maximum number of fields leads me to think I might have.

Each record in the table I'm querying contains several pieces of numerical data that might be recorded during a service visit.

Obviously I could query the table twice but that doesn't feel like the right way to go about it.

View 3 Replies View Related

Retrieve Figure Using Query?

Jun 14, 2007

Hi,

i have got a database which consists of table, queries, forms and reports.
I have one problem now is that I wan to do a query that will be able to bring the figure from another field to the current one.
ok say i have got Ref_No, Event_Date, Balance_BF, Adjustment, Balance.

so if say this is the first event for this particular ref_no (1234) it will bring the amount from another table (Principle_Table) linking the same ref_no (1234) to the Balance_BF fields,
If this is not the first event for this particular ref_no (1234) it will then bring the amount from the previous event Balance field to the current event Balance_BF field.

I am very lost how to do this. Is there a way doing this using query?

This is wat i mean
Ref No Event Date Balance_BFAdjustment Balance
06/00014 31-May-06 115140-5,757.00 $109,383.00
06/00014 31-Aug-06 109383-5,757.00 $103,626.00
06/00014 30-Nov-06 103626-5,757.00 $97,869.00
06/00014 28-Feb-07 97869-5,757.00 $92,112.00

U can see that the Balance_BF is actually brought down figure from the previous Balance starting from the second events. For the first event, the Balance_BF is actually draw down from another table (Principles_Table)

Is there a way to do this using query?

View 4 Replies View Related

Query - Retrieve A Set Number Of Records

Nov 4, 2005

Hi all,

I want to retrieve a set number of records from a table, using a query. I'm not sure of how to do this.

I can't use the ID, because the table gets its data replaced contantly by imports (so the ID doesn;t start at 1...)

I want to be able to retrieve, say, the first 25 records on that table.

Any help is appreciated

View 2 Replies View Related

Need Helps On Query Retrieve Range Of Dates

Apr 18, 2007

4/11/2007 1:01:28 AM
4/12/2007 2:02:52 AM
4/13/2007 4:21:30 AM
4/14/2007 2:22:21 AM
4/15/2007 3:34:53 AM
4/16/2007 4:02:37 AM
4/17/2007 5:03:15 AM
4/18/2007 7:17:34 AM

I need some helps
I have a table with date + time, how can I query so that it retrieve a 7 days range from today and go back ti 7 days

i though this should work (it works if the the table has date only no time)
Between Date() And DateAdd("d",-7,Date())

thanks

View 2 Replies View Related

Query Design To Retrieve Required Input

Apr 27, 2007

I have been asked to create a database in Access 2000 that will hold 1.6 million postcodes. There will be four fields within the a table one holding the postcodes, and three fields holding information as to whether or not the post code is classed as good, neutral or bad. The requirements are to allow a user to run a query that asks thenm for the required postcode and then displays the relevant information (good,bad,neutral).

There requirement is that the search is done as fast as possible returning the required results. Has anybody got any ideas as to the best way of doing this.

View 2 Replies View Related

Queries :: Retrieve Data From A Table From SQL Query

Feb 21, 2014

How to retrieve data from a table (via query) ? I created the below query, but I'm not sure what else is needed to retrieve the value from my SQL query. My query code is below. I'm not getting any errors.

Dim strClient As String
strClient = "Jerry Davis"
strSQL = " SELECT [Progress Tracking].[Client Name], [Progress Tracking].[Client Start Date],
[Progress Tracking].[Start Body Weight], [Progress Tracking].[Tracking Date]
FROM [Progress Tracking]
WHERE [Progress Tracking].[Client Name])= ' " & strClient & " ' "
MsgBox "Weight Box " & " " & strSQL

View 12 Replies View Related

Queries :: How To Retrieve Column Data Using SQL Query

Apr 14, 2014

I'm trying to retrieve data based on the contents of one column.

Sample table

Code:
Description EID Basecode
----------- ---- ---------
ssdad 1001 S2378797
gfd 1002 S1164478
gfdsffsdf 1003 R1165778
ssdad 1004 M0007867
gfd 1005 N7765111
gfdsffsdf 1006 W5464111
gfd 1005 N7765111
gfdsffsdf 1006 A4000011
gfdsffsdf 1006 W5464111
ssdad 1001 2378797
gfd 1002 1164478
ssdad 1001 965000
gfd 1002 780000
yjgk 4456 540000
kjhkh 2009 150000
ddd 1004 1040
d88jg 1004 14C676
fsa 6565 158
fdh 1004 2Khlm
ggdg 2009 967

I'm retrieving all **Basecode** column data starts with only letters other than 'W', 'N' by this query

Code:
SELECT tbl1.EID,tbl1.Description,tabl1.Basecode FROM tbl1 WHERE Not
IsNumeric(Left(Basecode,1)) AND Left(Basecode,1) Not In ("W","N");

And retrieving all **Basecode** if column data length >6 and with numbers '96', '78','54','15' by this query

Code:
SELECT tbl1.EID,tbl1.Description,tabl1.Basecode FROM tbl1
WHERE (((Len([Basecode]))>6)AND ((Left([Basecode],2))='15')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='54')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='78')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='96'));

How do i get other data which won't retrieve based on above queries, other than data mentioned on these queries like this

Code:
Description EID Basecode
----------- ---- ---------

ssdad 1001 2378797
gfd 1002 1164478
ddd 1004 1040
d88jg 1004 14C676
fsa 6565 158
fdh 1004 2Khlm
ggdg 2009 967

Third query not working

Code:
SELECT tbl1.EID,tbl1.Description,tabl1.Basecode FROM tbl1
WHERE (IsNumeric(Left(Basecode,1)) AND Left(Basecode,1) Not In ("W","N"))
AND NOT (((Len([Basecode]))>6)AND ((Left([Basecode],2))='15')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='54')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='78')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='96'));

View 5 Replies View Related

Creating A Query That Will Retrieve Different Data From Different Records?

Mar 17, 2014

I am trying to create a Database that will type our orders. I have a table with our customer list that includes both billing and shipping information. The problem is that sometimes one customer will request a "drop shipment" to another customer. Is it possible to retrieve different data from two different customers? Billing info for customer "A" and shipping info for customer "B" without creating seperate tables?

View 1 Replies View Related

Queries :: Can Retrieve Value Of User-defined Type In A Query

Aug 19, 2013

Is there a way to retrieve the value of a user-defined type in a query?

Here's the type:

Code:
Public Type ClassRank
Rank As Integer
ClassCount As Integer
End Type

I have a function with the following excerpt:

Code:
Function GetRank(strDOD) as ClassRank
...
GetRank.Rank = intRank
GetRank.ClassCount = intCount
...
End Function

In my query I expected to be able to put the following:

Code:
GetRank(strDOD).Rank & " " & GetRank(strDOD).ClassCount

However, Access didn't like the period in .Rank or .ClassCount.

Should I just write two different function to get 'rank' and 'classcount'?

View 2 Replies View Related

Modules & VBA :: Retrieve Data From Excel And Load It To Query

Aug 12, 2015

Current situation is that I have this form with a chart.

Row Source :

Code:
SELECT PolyWrongRegInsCount.[INSTITUTION], PolyWrongRegInsCount.[NO_OF_GROUP]
FROM PolyWrongRegInsCount;

PolyWrongRegInsCount; <- This table is one of the queries that I created.However, the data is manually added. I want to get the data from excel spreadsheet. And load into my queries

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

Forms :: Retrieve Info From Another Query - Higher Column Numbers?

Aug 22, 2014

When I attempt to use the me.field = me.combobox.column() method to retrieve info from another query,it only works if I use column 0 or 1... it doesn't work with higher columns number.

- field name: cbofi
- row source: listado-unico-fi <-- it is a query with unique values and 7 fields in total
- event procedure, change:

Private Sub cbofi_Change()
Me.txtDOCTPT = Me.cboFI.Column(1)
Me.campovia = Me.cboFI.Column(5)
End Sub

- txtDOCTPT is the field that indeed works
- campovia is the one that does not work

I tried using column(0) and column(1) and it worked fine... but higher column numbers do not work. Just mentioning because the field names are all right.

View 3 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

Parameter Query

Jul 28, 2005

Hi All,

How can I check the Parameter query interval is out of range?
Details:

I have a table with Date column. With parameter query(by Date field) I extract records between two dates. How could I make a check when taping in Inputboxes, am I or Not Between the Last and the First Date?

Thanks!

View 1 Replies View Related

Parameter Query

Aug 31, 2005

I'm writing a query which when run will prompt the user to enter criteria. In this case it is a workers id (like 000UA or 000UB)

My problem is I would like to have the ability to enter more than one criteria. What I want to do is to have the ability to enter several worker id's in the criteria field, like 000UA, 000UB, 000UC, 000UD, 000VA, 000VB, 000VE, 000VF, 000WA, 00WB

Is this possible and can someone explain to me how to do it?

Thanks

View 2 Replies View Related

Parameter Query Help

Sep 2, 2005

I am trying to run a parameter query that will prompt the user for "facility", but instead of displaying the results in table format, I want a form to display the results. I have already developed the form. I would also rather for the users to search by a list box instead of typing the facility. I cannot seem to figure this out. Please help.

Thanks.

View 1 Replies View Related

Parameter Query

Oct 19, 2005

Dear All,

I am having problems finding a solution to this problem. I am working on 3 databases at the moment..and am at the final hurdle to complete it.
I have built an Access database. I would like to generate a
number of reports which have to be exported directly into excel
individually.

I have a parameter query with 14 columns. One of the columns
is called GROUPS. I have a form with a button.
When you click on the button the parameter query asks for the
parameter value.

The parameter value must be a GROUP. i.e BURR, WIEN.

After you enter the group the parameter query generates results for
that particular group.


I have a number of groups which i would like to generate results
for at the click of the button on the form.

There are around 30 groups. but i only need to generate reports for
about 15 groups. The groups are stored in one of the tables.


So for instance after i click a button on the form
the results for each requested "GROUP" are exported individually into
excel.

Each group result must be in one excel file.

How can i achieved this. Do i need to use VBA? Please can you help.
I need a solution then i can apply this to a number of databases

Many, Many thanks

View 1 Replies View Related

Parameter Query? Pls Help

Jan 18, 2006

I want my msgbox to tell my user that this projectId does not exist in our db if the sql search returns an empty value. I get errors that i can't run this action query. please see red text. any ideas?

Private Sub Project_Quick_Find_Click()
On Error GoTo Err_Project_Quick_Find_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim Ssql As String

Ssql = "Select [projectInformation].[projectId] from [projectInformation]" & _
"where [projectInformation].[projectId] = " & Me![ProjId]

'DoCmd.SetWarnings False
DoCmd.RunSQL Ssql
'DoCmd.SetWarnings True

stDocName = "Project Status - Full Details"
stLinkCriteria = "[projectId]=" & Me![ProjId]

If Ssql = "" Then
MsgBox "A Project with this number does not exist in our database", vbExclamation, "Cannot find project"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

Exit_Project_Quick_Find_Click:
Exit Sub

Err_Project_Quick_Find_Click:
If Err.Number = 3075 Then
MsgBox " Please enter a Project ID to find! ", vbExclamation, "Empty Field"
Else
MsgBox Err.Number & ": " & Err.Description, vbOKOnly, "Error"
Resume Exit_Project_Quick_Find_Click
End If
End Sub

View 1 Replies View Related

Parameter Query

Feb 6, 2006

Hi, I'm a complete novice to Access and wonder if anyone can help me with this one please? I have a column in a query that is the output from a barcode scanner called WhenScanned from a table tblScans. The data in the column is in the format of the date and time for example: 20/01/2006 21:30:00 I want to be able to interrogate the data in the query by selecting a range of a date(s) and times for example from 20/01/2006 05:30:00 to 20/01/2006 13:29:00, date and time range from 13:30:00 to 21:29:00, date and time range from 21:30:00 to next day 05:29:00. I can achieve this by typing the required range into the criteria row of the query column in design view e.g. >=#20/01/2006 13:30:00# And <=#20/01/2006 21:29:00# for each range but I want to make it more user friendly so that a user can select type in the appropriate date and select the time range from a drop down list or something without having to edit the query using syntax. Thanks in anticipation.

View 2 Replies View Related

Query - Parameter

Mar 16, 2006

hi all,
im trying to do this query, and in it i am using fields from 1 table, and i have created 2 fields using the expresion builder (these come up as Expr1, Expr2).
these field (expr 1&2). & iwant 2 do use a parameter on Expr1, but when i go to view the query, it says i need to enter a paremter value for Expr2.. if i click OK then the parameter i need appears and when i enter the value i want no records appear.
i uses the followin expressions:

Expr1: DateAdd("d",+[Expr2],[Date of Joining])

Expr2: IIf([Membership Type]="Family - 1 Year","365",(IIf([Membership Type]="Family - 6 Months","183",(IIf([Membership Type]="Adult - 1 Year","365",(IIf([Membership Type]="Adult - 6 Months","183",(IIf([Membership Type]="Child - 1 Year","365",(IIf([Membership Type]="Child - 6 Months","183",(IIf([Membership Type]="Student - 1 Year","365",(IIf([Membership Type]="Student - 6 Months","183")))))))))))))))

thnx in advance, chia

View 2 Replies View Related

Parameter Query

Mar 21, 2006

Hey guys

I was wondering how I would go about making it so that a query will run or not run based on the input from a combo box.

I have a form with several combo boxes. And a couple of these controls a query that I would like to be optional. Right now it runs no matter what the input in the combo box, but I would like it to run based on the selection of the box (ie. "Yes" or "No" type input)

Your help on this is much appreciated

Nathan

View 13 Replies View Related

Parameter Query

Jun 20, 2006

I am trying to create a query for a database for a company I'm interning for. The query is supposed to bring up an individual machine from a column labeled Machine ID. This column contains 20 or so abbreviated Machine labels. When you run the parameter query, and you select the individual machine ID I get multiple results or it brings up a list, but it is incomplete. The machines sometimes share parts, so in the machine ID column for a part there may be up to 5 machine IDs separated by commas. I want to know if there is a way of isolating a machine coded K from a part that has K,SIM12,C40 listed for the machines that it goes to.

View 1 Replies View Related

Parameter Query

Mar 13, 2007

I have a search button on my menu form that, when clicked, asks the user to enter a desired Reference number they wish to search for. This works fine when it is a Reference number that is stored within the database.

I have tested it to see if it works with reference numbers that do not exist, and instead of giving an error message to ask them to retry, it opens up the form to a new record... That is not what I want it to do.

Please can someone help me, here if my code up to yet (not sure if the msgbox is correct btw):

Private Sub cmdSearchSite_Click()
On Error GoTo Err_cmdSearchSite_Click

DoCmd.OpenQuery "qrySearchRTP"
DoCmd.OpenForm "FRM_PRIMARY"
DoCmd.GoToRecord acDataForm, "FRM_PRIMARY"
DoCmd.Close acQuery, "qrySearchRTP"
DoCmd.Close acForm, "FRM_MENU"

Exit_cmdSearchSite_Click:
Exit Sub

Err_cmdSearchSite_Click:
MsgBox ("Site not found. Please enter a valid RTP Reference Number")
Resume Exit_cmdSearchSite_Click

End Sub

View 14 Replies View Related

Parameter Query

Mar 21, 2007

Hi,
I know how to create a parameter query where users could enter ONE criteria each time for a particular field of a table. Please see codes below. Now is there a way I can allow users to enter more than one criteria SEPARATED with commas for a particular field of a table?

Thank you.

Joe



"SELECT DEDPARMS" & payp & ".EMP_ID, DEDPARMS" & payp & ".FORMAT_NM, First(DEDPARMS" & payp & ".DEDPLAN_CD) AS FirstOfDEDPLAN_CD, First(DEDPARMS" & payp & ".DEDTYPE_CD) AS FirstOfDEDTYPE_CD, " & _
"Sum(IIf(Right([DEDPARMS" & payp & ".Dedtype_CD],1)='R',[overded_am],0)) AS [Employer Amt], Sum(IIf(Right([Dedetail" & payp & ".Dedtype_CD],1)='R',[Dedetail" & payp & ".ded_am],0)) AS [Employer Actl], " & _
"Sum(IIf(Right([DEDPARMS" & payp & ".Dedtype_CD],1)='A',[overded_am],0)) AS [Admin Amt], Sum(IIf(Right([Dedetail" & payp & ".Dedtype_CD],1)='A',[Dedetail" & payp & ".ded_am],0)) AS [Admin Actl], " & _
"Sum(IIf(Right([DEDPARMS" & payp & ".Dedtype_CD],1)='E',[overded_am],0)) AS [Employee Amt], Sum(IIf(Right([Dedetail" & payp & ".Dedtype_CD],1)='E',[Dedetail" & payp & ".ded_am],0)) AS [Employee Actl], " & _
"First(DEDPARMS" & payp & ".STATUS) AS FirstOfSTATUS, First(DEDPARMS" & payp & ".AGENCY) AS FirstOfAGENCY, First(DEDPARMS" & payp & ".ORG) AS FirstOfORG, First(DEDPARMS" & payp & ".TITLE) AS FirstOfTITLE, " & _
"First(DEDPARMS" & payp & ".STTL) AS FirstOfSTTL, First(Right(DEDPARMS" & payp & ".title,2)) AS RepUnit, First(Left([DEDPARMS" & payp & ".DEDTYPE_CD],2)) AS Type, " & _
"First(Left([DEDPARMS" & payp & ".DEDTYPE_CD],2)) AS LeftType, First(DEDPARMS" & payp & ".DEDTYPE_CD) AS FirstOfDEDTYPE_CD1, " & _
"First(Right([DEDPARMS" & payp & ".DEDPlan_CD],2)) AS Tier, First(Left([DEDPARMS" & payp & ".DEDPlan_CD],2)) AS Carrier, Plan.PlanDesc, Plan.TypeDesc " & _
"FROM (DEDPARMS" & payp & " LEFT JOIN Dedetail" & payp & " ON (DEDPARMS" & payp & ".DEDPLAN_CD = Dedetail" & payp & ".DEDPLAN_CD) AND (DEDPARMS" & payp & ".FORMAT_NM = Dedetail" & payp & ".FORMAT_NM) " & _
"AND (DEDPARMS" & payp & ".DEDTYPE_CD = Dedetail" & payp & ".DEDTYPE_CD) AND (DEDPARMS" & payp & ".EMP_ID = Dedetail" & payp & ".EMP_ID)) LEFT JOIN Plan ON (DEDPARMS" & payp & ".DEDPLAN_CD = Plan.Plan) AND (DEDPARMS" & payp & ".HLTH_TYPE = Plan.Type) " & _
"GROUP BY DEDPARMS" & payp & ".EMP_ID, DEDPARMS" & payp & ".FORMAT_NM, Plan.PlanDesc, Plan.TypeDesc " & _
"HAVING (((First(DEDPARMS" & payp & ".STATUS)) Not In ('P')) AND ((First(Right(DEDPARMS04.title,2)))=[Enter a Repunit]) AND ((First(Left([DEDPARMS" & payp & ".DEDTYPE_CD],2))) In ('01')) AND ((First(Right([DEDPARMS" & payp & ".DEDPlan_CD],2)))<>'00' And (First(Right([DEDPARMS" & payp & ".DEDPlan_CD],2)))<>'17')) " & _
"ORDER BY DEDPARMS" & payp & ".EMP_ID, First(DEDPARMS" & payp & ".STATUS);"

View 5 Replies View Related

Parameter Query

Jun 1, 2007

in ms access...when i make a parameter query, it asks for the parameter to match the whole field...how can i get it to accept an enquiry that matches 'any part' of the enquiry and then show all the matching results

View 1 Replies View Related







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