What I want to do is from several records find the Max() date and update that one record with my stuff. However, I get an error message cannot use aggregate in update query or something to do that effect. Is there a way to get around this?
Ok, i have a question about update queries.I have two tables (I'll call table 1 and table two for simplicity) and an update query. I want to get some data from table one to table two (via an update query). But in table two there is a field that isn't in table one but i want to add a value to that field via the query.My question is, can i manually put into the query what data to add to a field instead of/aswell as using data from other tables.I hope you understood my questions.Cheers
I have an update query built that checks to see if a date is entered for when a document is mailed as well as a date for when that document was received.
I'm trying to setup this query to check and ensure that if multiple documents (Form8) were mailed that each one was marked as having a received date before the Update query add's a "Graduated" mark to the student. Screenshots are attached.
Anyone have any idea on how I can set this up?
Basically the tblFormEight can have multiple entries assocaited with each EnrollmentID (aka Student enrolled in a class) which represents multiple Form's set out in the mail. I don't want this Update query to run unless all entries for each EnrollmentID have Received Dates.
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
hi all, I'm newbie here. please forgive me if I make mistake / wrong "room"
here what I need. I want to make update query in access 2000/2003. let say I want to update field "COST" to "0", which have condition field "ID" is 070.... (070. and something). the matter is type of field ID is numeric not string, so I can't use LIKE function. any suggest what I can do without change data type for field "ID" for permanent (I mean, if we can change data type for temporary with code, and turn it back with code too, that's no problem). I don't care, either use macro or update query (if update query can't do this task). thanks before
Was wondering if there is a way without building individual update queries, to update info in one field that has multiple criteria ?
Basically I need to change/update daily multiple ID numbers to new ID numbers, long story on why this needs to be done but for now I need to do it this way.
Example: 12345 update to ABCDE, 6789 update to FGHI, etc. These ID's are all within the same field in the table.
It works fine running each ID one at a time but was wondering if it is possible to do all these updates within one query or code ?
Table: TaskT Fields include; Description, Action, DueDate, Priority, Precinct, Recurring and Employee. Query: TaskQ Form: TaskF and TasklistF
The forms are fed by the TaskQ query.I have sort and filter on all fields except date field which i would like to have 3 buttons which will dynamically update the criteria in the TaskQ DueDate field. Is that possible or the way to do it??
The buttons would include 'Due today' 'Overdue' 'Next 7 days' and they update the criteria in the TaskQ query and hence filter with the following;
I have a form that run a query to select all the students taught by a given faculty member. Once the records are loaded, the faculty enters attendance data, selects a date from a combo box and hits a save button.I change my relationship and now need to be able to store the key for the field in the combobox and not the text.
How do I set the field, table and criteria in the update query to do this. The UD query uses the FacultyStudents query as its record source. Currently the FacultyStudents querry does not have the Key or the date fields since the date is selected by the faculty once their records are loaded. As I see it there is now way to make a join, so I think I either need VBA or SQL, which I am not very good (really bad) at wriitng. Can the necessary Sql be written in the query design view?
I need to update the periodtype field in my table depending on different values in the field Formtype- I am looking to do this without having to use VBA. I have the following fields in a table - I want to update the value of the field Period_type as follows -
When Formtype is 10-Q, update Periodtype to "Quarterly"
When Formtype is 10-K, update Periodtype to "Annual"
The current value of Periodtype for both formtypes is "Semiannual"
I'm trying to update a record in a table, from a query that is run as part of an event from a command button on a form.
I have a table called 'Assets', a table called 'Disposals', and a form called 'Disposal Entry'. I would like the user to select an Asset ID from a combobox on the form, then when the button is clicked it adds a record to the 'Disposals' table, and updates the Status for that specific Asset in the 'Assets' table to "Disposed".
It adds to the Disposal table fine, but I can't get it to update the Asset table.
My query looks like: Field: Status Asset ID Table: Assets Assets Update To: "Disposed" Criteria: [Forms]![Disposals Entry]![Asset ID]
I've checked the spelling and everything looks ok.
The [Asset ID] control on the form is bound to the Assets table. If I edit the control and clear out what is in Control Source, then it updates the table and works fine.
However, I want to keep it bound as I have a subform on my home page showing the latest disposals.
How I can get the query to use the Asset ID on the form as the Criteria?
I have 2 tables that must be involved in this query. Both have the same fields; one is a temporary table created from an Excel import which will be deleted later, the other is the permanent table.
tblStoreProducts is the permanent table. It has a 2-field Unique index; there can only be 1 of any ProductKey for a StoreKey (there can be multiple ProductKeys within a StoreKey, and multiple StoreKeys for each product, but there can only be 1 entry for each unique combination of ProductKey/StoreKey).
tblImportToStoreProducts is the temporary table. It holds all of the ProductKeys for one StoreKey.
My query needs to identify any ProductKey in the tblStoreProducts that does not exist in the tblImportToStoreProducts for that StoreKey, and then it must set the MaxUnits field to 0.
Basically, the temporary table is this years' inventory for a particular store. If a product was in that store last year but it isn't there this year, the quantity must be set to 0 because the ultimate aim is reporting hazardous materials.
Hello buddies :D, do you have any idea how to make this work?
To select data that falls within this criteria of date range between cboDate and cboDate2 (fields on my form). The date in [tblJobDetails]![timeIn] come in this format "08/17/06 10:24 AM", but the cboDate/cboDate2 (takes in date only e.g 08/17/06) what i am after is to evaluate specific hard coded time in addition to the date entered, i.e. even tho, i haven't entered time on the cboDate/cboDate2, I want specific time hard coded where e.g If i select a date range of 08/17/06 and 08/18/06 on my cboDate and cboDate2 it should really be evaluating: 08/17/06 8:00 AM to 08/18/06 8:00 AM.
This is the criteria i curentlly have on my query in design view tha works perfect in selecting date only. ([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) How can I incorporate 8:00am to 8:00am into my cboDate and cboDate2. What can i do to make this happen? Your kindness will be greatly appreciated http://www.naijaryders.com/forums/images/smilies/thankyou.gif
Wonder if anyone can help with the syntax in this query? It always returns no results and I can't for the life of me understand why.
SELECT tblExpectedShipments.ShipmentDate FROM tblExpectedShipments WHERE (((tblExpectedShipments.ShipmentDate)=IIf([Forms]![frmSelectShipperReport]![chkOverdue]=0,(tblExpectedShipments.ShipmentDate)>Date(),(tblExpectedShipments.ShipmentDate)<Date())));
Any pointers would be greatly appreciated. Thanks.
I have an update query for tGLCashAccount where it adds a value from another table with the BeginningBalance to arrive at CurrentBalance.
Here's what it looks like in design view:
Field: CurrentBalance Table: tGLCashAcct Update to: [tMakeNewCashBal].[TotalPrice]+[tGLCashAcct].[BeginningBalance]
Here is SQL code: UPDATE tGLCashAcct, tMakeNewCashBal SET tGLCashAcct.CurrentBalance = [tMakeNewCashBal].[TotalPrice]+[tGLCashAcct].[BeginningBalance] WHERE (((tGLCashAcct.GLCashAcctID)="102"));
I get the error: data type mismatch in criteria expression when I run it.
I am using a Form to input the criteria required for a query to run. All fields seem to work fine, except for the date field...(i hate dates!!)...i am using a Where clause and in the criteria field i have the following:
[Forms]![Bookings_Diary].[DateFrom]
However, when I run the form and input all the criteria required including the DateFrom textbox and click on the Load Query button, the system will still ask me to input the date field...
To make things clear, the DateFrom text box is an unbound text box having the format property set to 'Short Date'. In the query, the date field relates to a table Date/Time field..
Hey guys, I really need some help on this problem.
I have a database for a tutorial center, and we have invoices recording the dates of the lessons that students pay for in this month.
We have a reminder form that display query results when today is the last lesson for the student so we can give them a new invoice. This has been working perfectly well untill now, it suddenly no longer displays the student and invoice for their last lesson.
What happens is, if there are 4 last lessons on Sept. 17, it displays reminders for 4 students in a datasheet subform. However, Sept. 17 may only be the second last or third lesson for some of the students. It just randomly shows a student that has a lesson on Sept.17, not their last lesson.
Thanks ahead to anyone who can offer me any advice.
SELECT tblStudents.StudentID, tblStudents.StudentName, Last(tblDate.dtDate) AS DateOfLast, tblInvoice.InvoiceID, tblInvoice.Paid, tblCourse.ShortDescription FROM tblStudents INNER JOIN (tblInvoice INNER JOIN ((tblCourse INNER JOIN tblInvoiceDetail ON tblCourse.CourseCode = tblInvoiceDetail.CourseCode) INNER JOIN (tblDate INNER JOIN tblInvoiceDetail2 ON tblDate.DateID = tblInvoiceDetail2.DateID) ON tblInvoiceDetail.InvoiceDetailID = tblInvoiceDetail2.InvoiceDetailFK) ON tblInvoice.InvoiceID = tblInvoiceDetail.InvoiceID) ON tblStudents.StudentID = tblInvoice.StudentFK GROUP BY tblStudents.StudentID, tblStudents.StudentName, tblInvoice.InvoiceID, tblInvoice.Paid, tblCourse.ShortDescription HAVING (((Last(tblDate.dtDate)) Like "*" & [Forms]![frmReminder]![txtDate] & "*"));
I have a table with a field TDate (dd/mm/yyyy format). A query with calculated fields is lying on this table. I want to put a date criteria in this query, by a combobox in an unbound form, where the date format has to be mmmm/yyyy and has to be updated as new TDates come in.
Trying to pick up values for the combobox from the TDates field (and formatting them), I get a list with several same values. This is of course expected as there are many records on the same month, even on the same day of the month.Is there a way to have this list with unique values for each TDates month/year?
FTA # Date Attended Last name First name assigned person......
Each week I need to generate a report that shows the people that attended for that week, grouped by the assigned person. I only want to show the data for a specific "date attended" (i.e. that days date). I figured I first need to generate a query that only returns the data for that specific date in the "date attended" column. I did that but it is manuel by using the criteria field.
Is there an easy way to type in the date that I want the query to use as the criteria?
Below is the SQL I have on a Union Query. Each Query is based on a date range. The first Query date is Planned Immplementation Date. The second Query date is Revised Planned Implementation Date. If the Date in the Revised Planned Implementation Date is higher than the EndDateTxt Date Range I do not want the results to appear for that ECN. Any suggestions on how to accomplish this?
SELECT ECNBCNVIPtbl.[ECN Analyst], ECNBCNVIPtbl.[ECN Number], ECNDetailtbl.[ECN Description], ECNDetailtbl.[Planned Implementation Date], ECNDetailtbl.[Revised Planned Implementation Date], ECNBCNVIPtbl.[Serial Number Break Required?], ECNBCNVIPtbl.[Implementation Reporting Required?], ECNBCNVIPtbl.[Do Not Process] FROM ECNBCNVIPtbl INNER JOIN ECNDetailtbl ON ECNBCNVIPtbl.[ECNBCNVIP ID] = ECNDetailtbl.[ECNBCNVIP ID] WHERE (((ECNBCNVIPtbl.[ECN Number])<>"sample") AND ((ECNDetailtbl.[Planned Implementation Date]) Between [Forms]![EcnVisualStatusFRM]![StartDateTxt] And [Forms]![EcnVisualStatusFRM]![EndDateTxt]) AND ((ECNBCNVIPtbl.[Do Not Process])="yes")) ORDER BY ECNBCNVIPtbl.[ECN Analyst], ECNBCNVIPtbl.[ECN Number] UNION SELECT ECNBCNVIPtbl.[ECN Analyst], ECNBCNVIPtbl.[ECN Number], ECNDetailtbl.[ECN Description], ECNDetailtbl.[Planned Implementation Date], ECNDetailtbl.[Revised Planned Implementation Date], ECNBCNVIPtbl.[Serial Number Break Required?], ECNBCNVIPtbl.[Implementation Reporting Required?], ECNBCNVIPtbl.[Do Not Process] FROM ECNBCNVIPtbl INNER JOIN ECNDetailtbl ON ECNBCNVIPtbl.[ECNBCNVIP ID] = ECNDetailtbl.[ECNBCNVIP ID] WHERE (((ECNBCNVIPtbl.[ECN Number])<>"sample") AND ((ECNDetailtbl.[Revised Planned Implementation Date]) Between [Forms]![EcnVisualStatusFRM]![StartDateTxt] And [Forms]![EcnVisualStatusFRM]![EndDateTxt]) AND ((ECNBCNVIPtbl.[Do Not Process])="yes")) ORDER BY ECNBCNVIPtbl.[ECN Analyst], ECNBCNVIPtbl.[ECN Number];
I'm trying to setup a query to pull only the records that have the latest date in Time Scanned for each different serial number.
I have a table with 4 fields: Serial Number, Model Number, Location and Time Scanned. Some records will have the same Serial Number repeated with different Model numbers,locations and times scanned.
I can't figure out how to query only the Last Time Scanned for each different Serial Number. I've tried using "Last" for critria on the time scanned field, but I need that for each different serial number.
It's probably easy...but I'm not able to get it. Thanks!
Below is the SQL for a query I have, which returns events that are scheduled for today, I need to change this so that The user can specify events to be displayed in a date range and If possible only show those events for the users windows ID
Code:
SELECT tblEvent.EventStart, tblEvent.EventOwner, qryCompany.Company, ltDescriptionType.Description FROM (tblEvent INNER JOIN qryCompany ON tblEvent.Company = qryCompany.ContactID) INNER JOIN ltDescriptionType ON tblEvent.EventDescrip = ltDescriptionType.[DescriptionType ID] WHERE (((tblEvent.EventStart)=Date())) ORDER BY tblEvent.EventStart, tblEvent.EventOwner;
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)