Setting Up A Query

Mar 27, 2006

Hi,
I have a table I am trying to set up a query. I got into the query and set up the fields as follows: Name, Address, Landlord, Lease Date, 90 Day Reminder, 30 Day followup.

I want to show all these columns in my query. I need to set up formulas for the 90 Day Reminder and the 30 day followup from the Lease Date field.
The 90 Day Reminder is the date 90 days prior to the Lease Date, and the 30 day followup is 30 days after the lease date.

I am having trouble setting up the formulas. I did it in design mode, and I tried filling in a formula and when I tried going into the dababase mode, it asks for for a parameter. I am having difficulty understanding what to fill in for the parameter. I am not sure about the formulas either.

Can someone help me???

Thanks,

Marilyn

View Replies


ADVERTISEMENT

Need Help Setting Up A Crosstab Query

Oct 11, 2005

I have a table with 20,000 names in column 1.
Columns 2-8 are Yes/No questions.
I would like to set up a query to see how many people answered Yes for any combination of questions. I think a crosstab is needed, but I just can't for the life of me think how to do it.
Any ideas?

View 3 Replies View Related

Setting The Record Set Of A Query

Aug 15, 2006

Can i edit a query to equal a SQL string just like i do for my reports? for my reports i say:


DoCmd.OpenReport "Check Filter", acViewDesign, , , acHidden
Reports![Check Filter].RecordSource = strRecordSource
DoCmd.Close acReport, "Check Filter", acSaveYes


i tried to say

DoCmd.OpenQuery "Query1", acViewDesign, acEdit
Queries![Query1].RecordSource = strRecordSource
DoCmd.Close acQuery, "Query1", acSaveYes


i get an error in the middle line...how do i do what i'm trying to do?

View 2 Replies View Related

Setting A Value In The Results Of A Query

Dec 1, 2006

I have made a query and i want a tickbox to be ticked on the results.. (an escalated tickbox)

for some reason i cant make a macro with the following:

OpenQuery
SetValue

The query i'm using to detect if something needs escalating is quite complex, which is why i cant use an openform or similar?

Any help would be appreciated. James.

View 2 Replies View Related

Help Setting Criteria Within Query

Mar 11, 2008

Hello, I am working on a database to analyze weekly purchase results. With the goal being to determine the response rates for each promotion source that was used.

I have a table that contains PromoName, PromoCode, PromoQuantity, PromoSource and PromoDropDate. In another table I have imported 8 weeks worth of results and use the fields PromoCode and DatePurchased. An additional field called TransactionValue is auto assigned to the number value of 1.

I was able to create a query that looked at all the records with the same PromoDropDate and PromoSource field and then summed the values in the TransactionValue.

I would like to be able to see the results by week for 10 weeks but am not sure how to proceed. For example if the PromoDropDate is 1/10/08 I could look at the results based on DatePurchased being between 1/10/08 and 1/16/08, and then for 9 week periods after that.

I welcome any and all suggestions on the best way to approach this. thanks.

View 5 Replies View Related

Does Setting Validation In A Query Possible?

Oct 5, 2004

I'm making a database with 50 fields for the shops of my company. Among these fields, the data of 20 fields must be submitted to us (head office). The data of the remaining 30 fields (like customer address) is just for generating receipts.

At the begining, I set the validation rule of that 20 fields to be "Is not null" in the Form. If the required data (20 fields) is not entered, messages will appear and the record cannot be saved. Then I use the Query function to extract that 20 fields. However, our staff said they might not be able to obtain the information of the 20 fields in the first time. The customers may send them the info later on. So, it not good for me to set any validation rule in the Form.

I would like to ask how I can ensure they submit the data of the 20 fields if I release all the restrictions in the Form? Could I set any validation in the Query so that error message will appear if not all the required fields are filled?

Thank you.

View 1 Replies View Related

Setting Query Value From Form

Nov 11, 2013

I am trying to access the same query/report from different forms. For example I have a StudentAttendanceForm where users select a StudentID and then open the report. The query criteria for ID# is [Forms]!

[StudentAttendanceForm]![StudentID].

Can I access this same report from an event on another form. I'm thinking that if I can some how assign the StudentID from the form I want to access the report from, to the criteria on the StudentAttendanceReport Query, this is possible.

I am new to code but I am thinking something like:

SET [StudentAttendanceQuery]![StudentID] TO [StudentEnrollmentForm]![StudentID]
Open StudentAttendance Report

The StudentEnrollmentForm is the other form I want to access the report from

You may need a crystal ball for this one. Let me know what other info you need.

In general I am finding I am copying and tweaking queries to meet specific user needs. For example some want to access a single student and other need "batch" reports.

View 1 Replies View Related

Setting Criteria Within A Select Query

Aug 23, 2005

I have set up a query to pull data from within a date range.

I have written an SQL Statement to amend the format of the date field:

Effective Date: IIf([Date_Effective_From]="00000000",Null,DateValue(Mid([Date_Effective_From],7,2) & "/" & Mid([Date_Effective_From],5,2) & "/" & Mid([Date_Effective_From],1,4)))

Within my criteria I have:

Between [Forms]![Benefits]![date1] And [Forms]![Benefits]![date2]

(Benefits being the form). If I enter date range 01/01/2005 to 01/05/2005 I receive all data from 01 January to 01 May - but including different years i.e 2002, 2003, 2004 etc.

Can anyone suggest anything I may have missed?

Thanks

View 1 Replies View Related

Setting Parameter To Query In VBA Code

Mar 16, 2008

Hello Friends,
I have Query1 that should get one parameter , how to set this parameter in a code.

Below the code.


Private Sub Command0_Click()

Dim MyDB As Database
Dim MyRS As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheAddress As String

Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("Query1")
MyRS.MoveFirst

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
'
Do While Not MyRS.EOF

Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheAddress = MyRS![EmailName]

With objOutlookMsg
.To = TheAddress
.Display
End With

MyRS.MoveNext
Loop

Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub

View 2 Replies View Related

Setting Short Date In Query

Jan 17, 2006

I have a query where one field is Date:Now() so that todays date is forced in. However, it is giving me the date and time. I only want the short date, how do I achieve this???

Thanks!

View 2 Replies View Related

Evaluating Query Results And Setting A Value

Jul 25, 2007

hi

i have a query that returns a dataset that looks like this:

Account Status
123 Paused
123 Paused
123 Not Paused

I want to evaluate these results and in a second query, for the account 123 return the value "Not Paused" if there is at least one status set to "Not Paused".

How can i do this?

Thanks in advance.

View 13 Replies View Related

Setting Query Criteria In Code

Dec 13, 2007

I have a query that has 4 fields that are text fields in an external database. I have text boxes set up on a form which contain either null or >0 (depending on an option button selected). I want to pass that >0 to one field in the query and null to the other three. I have the following as criteria in my query:
[Forms]![frmSelectPayment]![txt2ndPayment] (same one for each of the 4 fields except the form field name changes)

Below is the code that sets the text boxes that are sent to the query:
Select Case [FraSelectPayment] 'depending on which pmt being pulled
Case 1 '6 payment plan only
stDocName = "qryGetPlusARImport"
Select Case [FraChoose]
Case 1
Me.txt2ndPayment = ">0"
Me.txt3rdPayment = Null
Me.txt5thPayment = Null
Me.txt6thPayment = Null
Case 2
Me.txt2ndPayment = Null
Me.txt3rdPayment = ">0"
Me.txt5thPayment = Null
Me.txt6thPayment = Null
Case 3
Me.txt2ndPayment = Null
Me.txt3rdPayment = Null
Me.txt5thPayment = ">0"
Me.txt6thPayment = Null
Case 4
Me.txt2ndPayment = Null
Me.txt3rdPayment = Null
Me.txt5thPayment = Null
Me.txt6thPayment = ">0"
Case Else
MsgBox "Please select a payment"
FraChoose.SetFocus
Exit Sub
End Select

DoCmd.OpenQuery stDocName, acNormal, acEdit


If I run the query alone I leave all fields blank and put >0 on the one I want to search by it works fine (695 records returned) but when I run it through code, nothing is returned. I really hope this makes sense to someone! Can anyone see what I am doing wrong?
Thanks

View 3 Replies View Related

Setting A Field In A Query From A Report?

Oct 6, 2004

I know its probably a simple one but I am new to access, so...

I have a simple membership database and in it I keep a record of who I am expecting to attend on a particular date. This is achieved through having a seperate field for each meeting on a simple yes/no type.

I would like to be able to print a report from a form for a particular date showing everyone that would be attending. I have a list box that shows all the fields. What I cant do is set the date I want in the query from the report, can anyone help?

thanks

View 2 Replies View Related

Queries :: Setting Zero Value In Crosstab Query

Jun 19, 2014

I have a crosstab query to summarise the counted string values from another query: E.g.;

TRANSFORM Count(Table1.Viable) AS CountOfViable
SELECT QryTable01.productName
FROM QryTable01
GROUP BY QryTable01.productName
PIVOT Table1.Viable;

As there are some null values returned (ie blank cell in the pivot table)

I used the Nz function to make this zero but when the query results are used in a report I want to add the rows to get row totals... but the result is as if they were string values;

So if I add a text box in the report with = [viable] + [Not viable]
t
Then the report row with the values:

Viable Not viable
14 12
displays as 1412

So how do I add the values in the rows???

View 1 Replies View Related

Setting Default Value On A Form From A Query?

Dec 9, 2014

I have a combo box field on a Student Details form that displays the Student's class number. For a new record, I am able to set the default value in the control's Default Value property with a literal in quotes (ie., ="2015-1"). But I want to set the default value from a query field. However, when I specify the query field in an expression ((=[Current Class]![Class Number]), "#Name?" appears in the field when initiating a new record on the form.

The control source for is the field in the Students table ([Students.[Class Number]).

The Row Source is a query of the Class table.

How can I set the control's default to the Class Number value in the Current Class query?

View 14 Replies View Related

Setting Query Search Criteria From A Form

Oct 30, 2006

Looking to be pointed in the corect direction,

having trouble using a text box on a form to set the search criteria for a particular field within a query.

Ideally i would like to enter the criteria in a textr box then click a button which sets the criteria and opens the query results in a report,

I have designed the query but cant which works if you go into the design and enter the criteria. the problem lies with getting the text box on teh form to set teh criteria.

If i use the expression builder to set the criteria to the same value of the "text" within the "text box" on said form the following happens,

If i open the query itself it opens a small window and displays the "expression" that i entered in the criteia box, above the data entry. the query does work this way but dont understand why the expression is displayed???
The text box on the form also becomes locked, not allowing data to be entered.

I have tried to link the query direct to the text box.
also tried creating a table which has data entered via form then linking the query criteria to a field in the table.

Could some one point me in the right direction please

many thanks

Cheers

watson

View 1 Replies View Related

Setting A Format In A Field In A Union Query

Jun 21, 2007

Hi everyone,

Please would someone be able to help me?
I have created a union query however, one of the columns, has not picked up the same format as it has in the tables. As in the tables it has this format
'00000'.

Please woud you be able to advise me how I can change the format on one of the 'columns' in my union query. As one column is 'numbers' and the other is 'text'. I need to change the number column so the format is '00000'.

Thank you in advance for your help.

Nats

View 5 Replies View Related

Simple Query Question: Setting A Field To A Set Value

Jul 6, 2007

Putting this in the field box in a query:

read or write: "r"

should create a field called read or write with a value of r in each record in the query, shouldn't it?

Why doesn't it, and how can I make it work?

View 2 Replies View Related

Make Table Query Setting A Primary Key

Feb 26, 2007

I am trying to create a new Table using a MakeTable Query

using the following sql:

Code:SELECT qCPPlannedStopsOnTargetTotals.WeekNumber, qCPPlannedStopsOnTargetTotals.Line, qCPPlannedStopsOnTargetTotals.Description AS Above, qCPPlannedStopsOnTargetTotals.[%] INTO mkCPPlannedStopsAboveFROM qCPPlannedStopsOnTargetTotalsWHERE (((qCPPlannedStopsOnTargetTotals.Description)="Above"))ORDER BY qCPPlannedStopsOnTargetTotals.WeekNumber DESC;

However i want the new table to have a Primary Key, (Week Number) can i set this as the table is made?

Please help

Andy

View 1 Replies View Related

Queries :: Blank Query After Setting Criteria

Feb 4, 2014

I've set up a form with a button to open a report based on the current name on the form. The idea is that as you look through the different pages on the form you can open a report for whatever one you're on and print it.

In my query I have a name field where I put the criteria: Forms!Formname.Textboxname

By clicking the button on my form I'm able to generate a report based on the name that appears in that textbox. It works great when I initially put it in but if I close the form (or query, or report) and open it back up it is blank.

Is this even possible with a text box? It seems like it when I open it, it has nothing to go off and that's why it's blank. I just don't know how to fix that.

View 7 Replies View Related

Queries :: Setting 2 Criteria For A DLookup Query

Mar 18, 2014

I need some syntax in setting 2 criterias for a DLookup query.

I've attached a sample db with 2 tables: Main & Timesheet

I need a "combo" query showing (on the same line) all Qty for Transcodes N, 1 & 2 where the Staff number and TSNum is the same.

I'm sure about the logic but the syntax is letting me down.

I can pull in 1 of the criteria E.g.:

OT1: DLookUp("Qty","ExOT1","[Staff] =" & [Staff])

But can for the life of me not script the second criteria in.

So in my result of ExCombo I'm getting Staff 11 showing 4 under OT1 while I know the result does not apply for TSNum 29832 as indicated hence the need for the 2nd criteria.

Since I have to change some of the values to text inside the query it might be best to have a look at the attached db rather than just suggesting the correct syntax .

View 3 Replies View Related

Problem Setting A Date Range On My Query Criteria

Jul 21, 2006

I have this criteria which should collect a date range (cboDate and cboDate2), it works well in collecting the date range if i put separate days (like 6/17/2006 and 7/18/2006, it'll collect the data matching those dates), but if i put the same day, say i want to get all the data for 6/17/2006. And cboDate and cboDate2 are both 6/17/2006. With this code, nothing comes up. Can you help me?

([tblJobDetails]![timeIn]>=[Forms]![frmPendingJobs]![cboDate] Or
[tblJobDetails]![timeIn]>=[Forms]![frmPendingJobs]![cboDate] Is Null) And
([tblJobDetails]![timeIn]<=[Forms]![frmPendingJobs]![cboDate2] Or
[tblJobDetails]![timeIn]<=[Forms]![frmPendingJobs]![cboDate2] Is Null)

View 3 Replies View Related

Efficient Way Of Setting Value Of A Textbox To The Result Of A Select Query

Apr 19, 2005

Anyone know an efficient way of setting the value of a textbox to the result of an sql query?

I am using the following, but it seems to be slow when populating a large form:

Make.RowSource = "SELECT BarcodeDATA.Make FROM (Customers RIGHT JOIN CustomerSales ON Customers.CustomerID = CustomerSales.CustomerID) LEFT JOIN BarcodeDATA ON CustomerSales.ItemNum = BarcodeDATA.ItemNum WHERE (((CustomerSales.ItemNum)=[Forms]![FormCheckConsignmentStatus]![ItemNum])); "

Make.Requery

Make.Value = Make.Column(0, 0)


Let me know if there is a better way to do this.

View 1 Replies View Related

Queries :: Checking Query For Null And Setting Operations

May 30, 2014

I have been working on an application where I am collecting survey data in a database. There are multiple survey tools available to the user, and it's possible to complete multiple survey tools in the survey.My problem is, it's possible for the surveyor to complete some tools on one day and other tools on another day. I am having problems with trying to figure out how to add a tool that has not been previously added and keep in the same survey which is all held under a single Survey Number.

The first step in the function is to set a Record Number temporary variable based on whether or not the tool has been used (it's possible to use multiple instances of a survey tool, so need to know if the Record Number is '1', or the next number in the sequence.I've been trying to do this by checking a query for a Null and setting the temporary variable using something like:

IF ISNull("RecordNumber","qryRecordHeader") Then '1'
Else
DLast("RecordNumber","qryRecordHeader") +1
End IF

The second half works just fine, so if there is a previous record, it will add. But if it's Null, it doesn't work.I'm trying to avoid opening a temporary form to run the query and checking a field. Is there a way around that?

View 3 Replies View Related

Queries :: Setting To Only Show Field In Simple Query Once

Sep 19, 2013

I have a simple query between two tables joined together by common fields. In my first table (Table 1 - tblLocations) I have information about a building i.e. Location Code, address and total sqft. . In my second table (Table 2 - tblAllocatedSpace), this contains details (Location Code, Room ID, SqFt assigned, etc.) of the space allocated in each building. The two tables are joined together when the “Location Code” in both table match.

In my query, I show the location detail from (Table 1 - tblLocations) and related records from (Table 2 - tblAllocatedSpace). My result looks like the following:

Location Code Sqft Address Assigned Sqft
106067 1,000 600 March Rd 10
106067 1,000 600 March Rd 15
106067 1,000 600 March Rd 12
106067 1,000 600 March Rd 20

The location code, Address and Sqft is rebated each time a space is assigned in (Table 2 – tblAllocatedSpace). When a build a report and need to sum the location Sqft, the number is multiplied by the number of related records in (Table 2 – tblAllocatedSpace). In this example by building total space is 4,000 sqft when I only it to show 1,000.

How do I set to only show the location code and sqft once?

View 1 Replies View Related

Forms :: Setting Combobox Rowsource To Be A Recordset Instead Of Query?

Jul 15, 2015

I have a Product form that shows the details of each of the Products in my Product table. I also have a "Pick a product" combobox (who's rowsource is being fed by the same Products Query that feeds the form). This allows you to go straight to a particular product by selecting its name. So far, so simple.

I've since added a couple of combobox filters which use different columns ("Product Type" and "Collection") to allow the user to get down to a more manageable recordset to then work with.

Of course, because the "Pick a Product" combobox is being fed by the Products Query, the combobox can end up showing products that are not contained in a filtered recordset. This is... sub-optimal.

Is there a way of telling the "Pick a Product" combobox to use the products listed in the recordset as its rowsource rather than the product query? So that it only lists the products the user has filtered down to?

View 3 Replies View Related







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