Query To Retrive All Orders Made Within The Last 7 Days

Hi, I wonder if any one could help me with what I think is a simple query.

I would just like to show all the orders thats have been made within the last 7 days.

So far I can retrieve all the orders made today, by using 'Date()' as my criteria, but cant figure out what criteria to use for the last 7 days. It would also be good, if i could figure out how to retrive all orders made within the last month, and as well select all orders made between two specific dates.


View Replies


Query From 2 Queries To Retrive Limited Records

I am in need of help to sort out some records. I have tow existing queries I would like to combine and get one final set of records out of. They go like this:

Query 1. (unique #)
Lot Protocol Sample # 1 mth 2 mth 3 mth
X ABC 1 x x (check
Y ACD 2 x x boxes)

Query 2. (unique #)
Lot Protocol Sample # 1 mth 2 mth 3 mth
X ABC 1 8/8/05 9/8/05 10/8/05 (query
Y ACD 2 8/8/05 9/8/05 10/8/05 performs calculations)

What I am looking to retrive through the third query is this:

Query 3. (unique #)
Lot Protocol Sample # 1 mth 2 mth 3 mth
X ABC 1 8/8/05 9/8/05
Y ACD 2 8/8/05 10/8/05

Where the third query only shows the calculated dates when the check box is true. So for month 1 & 2 I get dates for Lot X and for Lot Y I get dates for month 1 & 3. I have tried to go through the expression builder, but to no avail. I either get all records, like query 2 or I get nothing reported. I am not sure how to limit the records based on the check boxes.


View Replies View Related

Delete Old Orders Query

I want to write a query that would delete records from 3 linked tables

Customer has Orders that have Items

The Order table holds the date of the orders. I want to delete all customers that have not placed in order since a user entered date.

Not got off the ground on this one. Any help appreciated.


View Replies View Related

Query If Any Changes Have Been Made

I have created a button to save changes and to undo changes on a form. However if the user has not made any changes, i get a message saying that the Undo command is not available and the same with save changes.

Therefore if no changes had been made i would like to just ignore that part of the action and continue with the rest of the event procedure.

My code for undo is..

Public Sub UndoChanges_Click()

DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Me.frmtabContact_Details.Enabled = False
Me.frmtabCustomer_AC.Enabled = False
Me.frmtabCustomer_Options.Enabled = False
Me.Edit_Contact.Visible = True
Me.frmSave_Changes.Visible = False

End Sub

View Replies View Related

Undo Changes Made By Query.

Hi, i am stumped.

I have two tables Tbl_Referrals and Tbl_CMSData. Both of these tables have an identifier in called ConflictID. I have created a query which selects the records from both tables where the conflict ID is the same.

I have a form running this query. Down one side of the form i have all the details from Tbl_CMSData and on the otherside of the Form i have the corresponding details from Tbl_Referrals. I need the user to be able to update field by field from Tbl_CMSData to TblReferrals. This is done by means of a simple update query for each field. This all works fine.

Problem - I need an undo button for each field. Me.Undo does not work becuase the changes have been made by a query and not on the form.

Is there a way of undoing what the query has updated? Possibly by setting the focus to a Tbl_Referrals and then undoing the changes?

Thanks in advance

View Replies View Related

Identify Any Changes Made To Query Criteria ?


I was wondering if there is anyway to be able to identify or monitor changes made to a query.

Basically looking to identify if anyone goes in and manipulates the criteria field within the query ?

Using Access 2003.

Any thoughts or help are greatly appreciated.


View Replies View Related

Question 2: Pre-made Query Access In VBA

I would really like to populate a combobox with a list of queries. This would allow the user to add a group of data into a form's subform all at once. Although I have no clue how to use the pre-made queries from VBA or even how to get access to them via a combobox.

Any ideas? If I didn't make myself clear, I can explain further. Thanks in advance!

View Replies View Related

What Query Made A Table - Version: 97 (8.0)


is there any way i can find out what query (if any) was used to make a particular table in a database?
apart from searching manually through the queries


View Replies View Related

How To Retrive Data From DB

hi all, :D

i am new in this forumn i have one access db in which i have one table all Customer having info of no of customer i want to design one form in access which access the record from table customer and also i am able to edit and update the reocrds in form i want to navigate the records as fristrecords,next record,prevoius record, and last record how can i do this pls help me regarding this...

Nilesh thakur

View Replies View Related

How To Run An Access Made Query Using Code - Version: 2003 (11.0)

I have forgotten how to do this and I know i have done this in the past. I just don't remember what its called.

Need to run a query created in access by calling it with code.

View Replies View Related

Second Combo Made Visible Based On Associations Table And Query

I have a form that is used for recording test scores. The first selection that is made is a type of test. After the test is selected, some tests have a second sub-type of test that needs to be recorded. My quetion lies in how to hide or grey out this second combo box until a test is selected that requires it.

I don't want to "hard-code" it in the sense that I create an If Else statement that requires looking at values from the 1st test type combo box. I want to make sure that the DB is scalable and when additional tests are added, additional sub tests can be added if necessary.

If this makes sense and anyone has any ideas, I would appreciate it.

View Replies View Related

How To Retrive Automatically Generated Results

Hey guys.This is a real basic question but I am a newbie at this.:confused:I have created a form in Access that is actually an INVOICE for my company and therefore I have fields like [qty1],[rate1] & [amount1] In the form in [amount1] I have used the following expression to get automatically generated values.=[qty1]*[rate1]This gives me the Amount. But problem is that the result that is automatically generated by this mathematical operation is not stored in my database under the field amount1 and the field is therefore blank. I wish to use this resulted value in a report and also want to use it in other forms e.g. my sales register.kindly help me out with this.:)

View Replies View Related

Trouble Implementing The Regular Days And Sunday Working Days?

Hello everyone,

I have problem with my code here. I am using this code to determine if the LogDate with a weekday of Sunday can be declare as Sunday Work or Regular Work. The 1st week of my entry can determine if the LogDate is Sunday then compute if it reaches a 7 days working, if he is absent even 1 (one) day in his previous working days within the week. His Sunday LogDate is considered as Regular Days instead of Sunday Work. Can anyone tell me what is wrong in this code?

The problem here is the computation of 7 days after 1 week. There should be a 7 days computation every week per month in able to declare Sunday Work or Regular Work. I tried this code but it did not work on 2nd week, 3rd week and 4th week of the month.

How come on 2nd week, Sunday (LogDate) is not considered as Sunday Work even he completed the 7 days (working days) per week? I need help on this ASAP Thanks


Below is the code i'm using for defining Regular days and Sunday Working Days:

Private Sub LogDate_AfterUpdate()
Dim rst As DAO.Recordset, rs As DAO.Recordset
Dim db As DAO.Database
Dim dteToday As Date, dtePrior As Date
Dim i As Integer

dteToday = LogDate
dtePrior = DateAdd("d", -6, dteToday)

Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT [HolidayDate] FROM tblHolidays", dbOpenSnapshot)

rst.FindFirst "[HolidayDate] = #" & dteToday & "#"
'See if the date entered is a holiday
If rst.NoMatch Then
Holiday.Value = 0
Holiday.Value = 1
End If
If Weekday(dteToday) = vbSunday Then 'If dated entered is a Sunday determine if
Dim strSQL As String 'it will be a regular day or a Sunday

strSQL = "SELECT [LogDate] "
strSQL = strSQL & "FROM tblLog "
strSQL = strSQL & "WHERE [LogDate] >= #" & dtePrior & "#"
strSQL = strSQL & " AND [LogDate] <= #" & dteToday & "#"

'Create a recordset of records from date entered and 7 days prior
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

i = rs.RecordCount 'Count the number of days between the two dates

If i = 7 Then 'If there are seven days then it is a Sunday
Sunday.Value = 1
Sunday.Value = 0 'If less than 7 days then it is a regular day
End If

Sunday.Value = 0
End If

DayofWeek.Value = Format(dteToday, "dddd")

End Sub

View Replies View Related

Date Add Problem (calendar Days Vs Working Days)

I have a query and I need the records to display 3 working days before the 15 working day deadline.

I used the following in the criteria box below the received date field and it doesn't pull the correct number of workdays, it's pulling calendar days instead.


Can anyone help, thanks for your time!!!

View Replies View Related

Date Add Problem (calendar Days Vs Working Days)

I have a query and I need the records to display 3 working days before the 15 working day deadline.

I used the following in the criteria box below the received date field and it doesn't pull the correct number of workdays, it's pulling calendar days instead.


Can anyone help, thanks for your time!!!

View Replies View Related

Calculate Days In Advance Or Days In Arrears

I rent out a property , on the rental statement I have a field [Datepaid], [RentpaidFrom] and [rentpaidTo]. I would to have a field that can calculate the rent that is paid to show if the rent is in arrears or in Advance. I guess the code would be something like (datediff ???? etc) but i have no idea what it should be. the calculation should appear on the query as i.e.2 days in arrears or 12 days in advance etc

your help would be much appreciated

merry christmas to you all

View Replies View Related

Query For Last 7 Days - Mon To Mon

trying to think my way around this one. i am in search of a query that will allow users to see what they have ordered within the last week (7days max) which starts on monday of each week eg if they run the query on thurs, they will see mon, tues, weds & thurs and not just 7 days from thurs [Date()-7]

i'm assuminging its gonna be something like if day=monday then query will = date() else if day=tuesday then query will = date()-1 and so on.....

View Replies View Related

Run A Query Every 10 Days Etc

Hi i need to make a query run every 10 or so days as it is a query which checks if any printers in the database are running out of warranty

Can anyone help on this

I basically am trying to make this query run where if there is any data a report will preview stating this printer warranty is expiring etc

Many thanks in advance

View Replies View Related

Count Days In Query

I got an assignment from my supervisor and I am not getting it! :(

I have a query (see result in attachment) with the following fields:
tID, emailID, emailtype and EmailDate.

A customer (tID 1297542) sends an e-mail (emailtype 1) to the company on 2-8-2005.
The company replies on that e-mail (emailtype 3) on 5-8-2005.

I would like to create a query that shows per tID the total of days between the e-mail from the customer and the e-mail from the company (between emailtype 1 and 3).

View Replies View Related

How To Get Working Days In The Query?

Hi, i have a problem
I need to create a query that shows me only days which r:
1. working days
2. which r not in the table on which the query is based
Thanks in advance

View Replies View Related

Number Of Days Query Help

I imported an large Excel file with a date column consisting of 3 different date formats and need help on a query to extract the number of days. Examples of the date on that column:


Appreciate any advise.

View Replies View Related

Help With Query-limit On Days

I am working on my DB for work and am almost finished with my DB. I have a query that gives me totals for days. This is the code that I have been using.

TotalTMD: IIf([SumOfTMD Total]>=180,IIf(IsNull([SumOfLOA Total]),180,"180"),[SumOfTMD Total])

TotalLOA: IIf([SumOfLOA Total]>=180,IIf(IsNull([SumOfTMD Total]),180,"180"),[SumOfLOA Total])

The "TotalTMD" and "TotalLOA" days are limited to 180 days for each table. However what I need to do now is limit the combination of both fields to 180 days. Is this possible?

Since "TotalLOA" is more serious, I would like to use what ever days are in this field and then include what ever days are left over to total 180 days from "TotalTMD" days.

Maybe I could use this as an example:

Name TMDDays LOADays Total days
John 190 20 210
Jim 80 90 170
Tony 250 190 440

Should display:
Name TMDDays LOADays Total days
John 160 20 180
Jim 80 90 170
Tony 0 180 180

Any help would be greatly appreciated.

View Replies View Related

Query The Number Of Business Days

Hello all,

I have 2 tables:
- Employee
- PackageTracker (Contains PackageNumber, date received, date sent, status)

I would like to query:
- which employee has the package
- How long have we had the package (calculate only business days)
- What is the status

I would like the things mentioned above to be ran in one query.

I am stuck with the calculations. I found a macro code to calculate the business days but I am stuck.

Please advise.

Thank you,


View Replies View Related

Working Days Query Problem

Date Recieved: Date letter in

SLA: combo box: 7 days
15 days
20 days

SLA Date: Date recieved plus 7, 15 or 20 working days.

Any ideas on how I would do this?

View Replies View Related

Number Of Days Between Dates In Query

I want the number of days between a specific date (roll out date) and 12/31/2005 so that
I can use the number to project revenue for this year.

This is what I'm using but it doesn't give me the right number. I don't know how to transform
something to a datetime variable so maybe that's the reason. Can you help me out?

Expr4: Day(12/31/2005-[Scheduled Roll Out Date]-0.49999)

View Replies View Related

Calculate Working Days Between 2 Days

Dear All,

I'm new to VBA coding. A code below is copied from a friend of mine and I can't make it work. How to call up this function in my form. In my form I have 3 text boxes (StartDate, EndDate and NumOfWorkDays). My form is based on a table.

Please anyone who would help me on this, kindly give me the step by step procedure as I am really novice. Thanks in advance.

'*********** Code Start **************
Public Function WorkingDays(StartDate As Date, EndDate As Date) As Integer
On Error GoTo Err_WorkingDays

Dim intCount As Integer

StartDate = StartDate + 1
'If you want to count the day of StartDate as the 1st day
'Comment out the line above

intCount = 0
Do While StartDate <= EndDate
'Make the above < and not <= to not count the EndDate

Select Case WeekDay(StartDate)
Case Is = 1, 7
intCount = intCount
Case Is = 2, 3, 4, 5, 6
intCount = intCount + 1
End Select
StartDate = StartDate + 1
WorkingDays = intCount

Exit Function

Select Case Err

Case Else
MsgBox Err.Description
Resume Exit_WorkingDays
End Select

End Function

Can someone please direct me to the right path.

Your help is highly appreciated.


View Replies View Related

Query Orders Problems - Version: Any Version

Hi Everyone,

I'm very beginner and I hope somebody can help me!
I've attached a file. In this small test I've noticed a problem.... if I change the unit price on the products table or on the orders query all the records will change with the new price.
HOw can I make it to avoid this?
I've looked on the Northwind example and I've seen that unit price is also present on the orders table, but how came automatically the unit price from the products table?

Thank you.

P.S. apologize my english

View Replies View Related

Query Calculating No Of Days Between Start And End Date

i am trying to run a query from a form which will bring up the no of days difference between the start and end date also on the same form.
The query doesn't bring back any results can someone please guide in what i am doing wrong.
Here is the query
SELECT DateDiff('d',[start date],[end date]) AS [no of days]
FROM [booked property]
WHERE ((([booked property]![start date])=[forms]![booking]![booked property]![start date]) AND (([booked property]![end date])=[forms]![booking]![booked property]![end date]));


View Replies View Related

Days=NextDate-CurrentDate But How In Access Query?

I have two tables
with fields
(AccountNumber, Name, AccountTypeID, Address, Phone, Date A/C Opened)

(TransactionID, TransactionDate, Particular, ChequeNo,AccountNumber,AccountTypeID, Rate, WithdrawalAmount, DepositAmount)

I created a query based on these two tables
(AccountNumber, TransactionDate, Days)

In this query Days: (NextTransactionDate-TransactionDate)
How I access NextTransactionDate of a specific Account in the record?

View Replies View Related

Query Expression To Find Records 30 Days Past Due

I am trying to run a query to print invoices that are 30, 60, and 90 days past due. What expression do I use to search for records that were purchased 30, 60, 90 days prior? I was able to find the expression to add time for the due date but was unable to find the expression to subtract time for my search. Thanks for any help!! Beck

View Replies View Related

Combo Box "unable To Retrive Data"

I have a frm (frmWMS) which has 4 fields,
Location, Room, Number and Quick dial

Its based on qryWMS which has one criteria in the Location field, therefore the form shows all the results for bath or bristol or wherever the user selects.

I have gone to add a combo box that lets the user select a record based on which room they choose in the combo box, but when i use the wizard it says unable to retrieve data......

I can see no reason and its driving me nuts, ive searched for everythin i could think off!

View Replies View Related

Select Days Of Week To Incorporate Into Append Query - Version: 2000 (9.0)

Hi all,

Don't know if this is going to make much sense, but here goes

I have an unbound form, that includes a combobox for the Team and a text box that is for the W/C date (code checks to see if it is a Friday date). Underneath that I have 7 check boxes for Fri to Thurs. There is then Shift Start Time and Shift End Time text boxes.

What I want to do is update the tblShifts table:
shift_id (autonumber)
user_id (linked to tblUsers which includes the team_id)

So, my questions is, I know how I would do this if it was just for one date - but the user can check any variation of the check boxes, so how do I incorporate this into an update query (or indeed code variables that I can use), so that each user in the team selected gets their shifts appended to the Shifts table?

Any help would be greatly appreciated, as I'm slowly going crazy on this one.....

View Replies View Related

Orders Calendar

i am trying to find a code that will present me some orders calendar of rooms.
i a trying to build some calendar that will show me the order date and the end date of the roon, rent by te customer, somehow that i will see that all the dates between these two date are occupied, like an outlook calendar.

View Replies View Related

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