Tables :: Calculate Value For A Field Based On Value Of Another Field - Statement
Dec 30, 2012
I'm trying to calculate a value for a field based on the value of another field, [Field1] has a value list of 28 choices I want [Field3] to take that value and multiply it by the value of [Field2]. I'm using an Iif statement and it sort of works. I looks like this:
IIf([Field1]=1 Or 2 Or 3 Or 4 Or 11 Or 12 Or 13 Or 21 Or 22 Or 28,[Field2]*0.06,IIf([Field1]=5 Or 6 Or 14 Or 15 Or 23 Or 24 Or 29,[Field2]*1.1,[Field2]*2.1))
I receive nor errors but it will only return the value of [Field2]*.06 no matter what is selected in [Field1].
I'm sure I'm missing something and there is probably an easier syntax to use, but I'm at a loss at the moment.
I need to have a field in a database that will calculate the age of a person, based on their DOB. I have it in the excel sheet that I imported into Access to create the data base, but it just copied the number that was already there. When I add new entries into the database, the age isn't calculated. How do I do this?
The forumla I use in my spreadsheet is: =DATEDIF(O2,TODAY(),"y")
Within my table if Field 1 has an answer of Self (from drop down), then, I would like Fields 6-12 to auto populate; however, if Field 1 does not have an answer of Self, then leave Fields 6-12 blank.
I am not quite sure how to lay this out. I am using Access 2010.
I (will have) a form which a user fills in to enter new data.
I have two fields,
"Branch" and "Branch ID" (Branch ID will not be on the form, just in the table)
Branch will be fed by a combo box with seven choices. I would like it so that when "Branch" is populated it autopopulates Branch ID with a code which relates to the branch, so for example
the table 2 is the source of a form that will let the user change the numbers. table 1 should change Date1 and Date2 Fields based on the two fields (3months) and (6months) if i want to make a lookup wizard it should be changed manually and if i make a calculated field i can't find other tables in the expression builder
I have a main table which is autonumbered on unitid, I have another table which is linked via the unitid which holds items purchased for the main table, so the second table is a subform of the suppliers and will have multiple entries of the same unitid. What I would like to do is when an item is entered into the second table, check the main table to see if it exists, if it does populate the unitid field with the unitid from the main table, and if not exist create a new record in the main table with the next unitid number.
This in essence is what I want, bearing in mind that the tblinvoices is a subform and the tblmain is not open.
If ([tblinvoices]![Unit] = [tblmain]![Unit]) Then [tblinvoices]![UnitID] = [tblinvoices]![UnitID] End If
I currently use forms for adding new pupils, and updating pupil subjects/arrangements/levels.
I also have forms to search for specific pupils, and to create lists for faculty heads showing which pupils are taking subjects within their faculty and the arrangements we expect to provide.
I use the forms to run queries, which can then output to reports for printing.
Where I am currently having an issue is the faculty field in the tbl-SubjectLevelArrangements. (If I didn't have to report to faculty heads I would just leave it out, but management will insist.)
Currently I have a form with dropdowns for adding subject, faculty, level and arrangement manually. This is acceptable for the subject, level and arrangement because they are completely interchangeable and dynamic throughout the academic year as pupils may drop down a level, or change the type of arrangement they require.
However as faculties are inextricably linked to subjects, I want to remove the possibility of human error. i.e. when a user (me) chooses either geography, history, or RE, then the faculty will always be Humanities, likewise if the user chooses French, German, or Spanish, then the faculty can only be Modern Languages etc.
I'm convinced there must be a very simple way to ensure that the faculty field prefills based on the limited keywords available in the subject field, but I just cannot figure it out.
How to set up my tables as I'm just starting off with setting my database up.
I'm doing a simple database to track the purchase orders (PO) I am managing. Each PO has a PO Number and an Original Value. POs may have multiple amendments which would change the PO value. I would however like to keep the history of the PO original value and all different amendments.
So I created two tables:
tblPO: ID PO Number (Number) PO Original Value (Currency) PO Sum of Amendments (???????????) PO Current Value (Calculated = PO Original - PO Sum of Amendments)
tblPOAmendments: ID PO (Lookup from tblPO) PO Amended Value (Currency) Amendment Date (Date/Time) Amendment Desc (Text)
Now the two, million dollar questions are: 1.) Is this the right table structure to use. 2.) How do I go about calculating the Sum of Amendments field?
In a form, the value of any field may determine if the other field will be true or false. For example in my form, inventory, if value in code is equal to 2 then the Field Table will be automatically false.
I am trying to calculate a value based on comparing the current date to the dates in these fields. I am using the below formula. However, using 6/27/2013 as the current date, my formula keeps resulting in "Bronze" when it should result in "Standard" Am I doing something wrong?
=IIf(Date()<[Bronze],"Standard",IIf((Date()>=[Bronze]) And (Date()<[Silver]),"Bronze",IIf(Date()>=[Silver] And Date()<[Gold],"Silver",IIf(Date()>=[Gold] And Date()<[Platinum],"Gold","Platinum"))))
I have a lengthy CASE statement in my database that displays specific text in a field based on the value of another. Simple stuff but for some reason it randomly will not work on certain values, and never the same one twice. Is there a commonly known cause for this? I have verified that the spelling and spacing etc. are correct in my code so that shouldn't be causing the problem.
I'm trying to run an if statment, on the records in a field (called "Current_Month"), in an existing table called ""Current_Months_Lag1_Data".
The IF statements work fine - and simply perform a different action for different data in "Current_Month".
I am having problems referring to "Current_Month", where I keep getting 424 (Object required) and 3420 (Object invalid) error messages, on the last line of code.
I have defined & identified the table in which the field is located, yet somehow cannot identify the field within that table. (I've already tried searching the web for similar problems under error messages 424 & 3420).
Function LAG_Forecast_03() Dim dbs As Database Set dbs = CurrentDb Dim Tbl As TableDef Set Tbl = CurrentDb.TableDefs("Current_Months_Lag1_Data") Dim FLD As Field Set FLD = Tbl![Current_Month]
I have started work on a database to track the many (several hundred per annum) projects my company undertakes. A 'main' table lists projects, their fees, their key dates, their project numbers, etc. I have created another table for tasks. Each task is assigned to a project (via the project number), and may be 'open' or 'closed'. I have separated the tasks table from the projects table as there may be several different tasks for each project. It is also good to keep a record of the tasks.
I want to prepare a report from the projects table that lists projects IF they have any open tasks.
In my mind, this means 'If a task, with the corresponding project number, is open, put a 'Yes' in the 'Tasks open' field of the Projects table.'
I'm creating an accounting database for my use at work. I order goods and services from a multitude of vendors, using varying payment methods, and at last count, 8 different accounts. The time I'm spending on repetitive entry into excel spreadsheets has forced me to sit down and make an access database to track everything.
Right now, the following: 1) Table named "Accounts" with two fields - Account # and Account Description. Account # is PK. 2) Table labeled "Orders", which I'm going to have the top-level information for each order (order #, Account #, Account description, + others that don't matter here). I have another table for the order details (product #, description, price...). 3) Relationship between "Accounts" and "Orders" is one-to-many, enforced referential integrity, cascaded update.
For my order entry form, I want to enter the account description, so I set up a combobox. But, for my paperwork, I am going to need the account # to print when I do a report, and for future flexibility I want that field to remain in the "Orders" table.
I know my accounts by name, not number, and I want it set up so that when I select, for instance, "Supplies Account" for the description on the form, the Account # field on the Orders table is automatically populated with the account # that correlates to that description.
Is there a way to tell the table to auto-fill this entry?
All; using Access 2010. I need to have some kind of way to track changes based on different field name.I have a client table with field data like Fname, Lname, SSN, Address, Zip, Phone, DateOfBirth, Current Rate, TotalRate, Status and Importdte. I have an import into the database every month and I update this table with data that is new based on the SSN with an append query. The import also has the names of those that exist in the client table until their status changes. In addition to appending new data every month; I would like to append any changes the existing client has. For ex; If an existing client has an address change, I want to append this data to the table but keep the existing address and have a Change date equal to the Importdte. In essence; I want to build a kind of history table that when I pull up a client; I can have something like a tab on a form with the changes and when it happened.
I have two tables: Focus and Comp..I want to join these two tables based on field: DwId...For this example, I made a Comp table that has 3 DwId's not present in the Focus table.When I run the below statement, I am not getting the 3 records only present in the Comp table in the result.
SELECT Focus.DwId, Focus.PRD_May2012, Focus.PRD_May2012 - Comp.PRD_May2012 AS PRD_DiffMay2012 FROM Focus RIGHT JOIN Comp ON Focus.DwId = Comp.DwId
I am in the process of revamping an old database. I have a main table that currently has two fields "Name" and "Job" but will have more. I have another table with the same fields. I want to use as a lookup to populate the main table with a user form from the second table. I can populate the "Name" field using a combo box, but my problem is how to autopopulate the "Job" field. E.g. If the user selects Mr Smith from the "Name" drop down list, the corresponding "Job" populates the second field.
I have a field in a table that is to be concatenated from two other fields, PolPrefix and PolNum. On a form I got it to show the full field 'PolicyNumber' by making the control source =[PolPrefix] & [PolNum].
But this doesn't update the field PolicyNumber in the respective table, and only shows it on the form. How do I get a concatenated field defined by the user into a table so that I can call that field other places in the database?
I am very new to access and I am trying to figure out how to build an expression for one of my fields. I have a field called Order Date, which holds the date of when an order is filled. I then have another field called Fill By Date. This new field I want to be 2 weeks after the Order Date. Is there a way to auto fill this information so that when I enter a date into the Order Date, it will enter the date that is 2 weeks after into the Fill by Date?
Action -- Calculated because if enrollment is higher then max. class size then its says full otherwise it will tell enrol
Table 2:-- Teacher And Class Income
Class --- text
enrolment --- number
max class size ---- number
income per enrolment ----- currency
incomer per class ----- currency ?
1) but what i wanna do is if i change enrollment and max class size VALUE IN TABLE 1 ... i want that change in table 2 enrollment and max. class size FIELD AS WELL For e.g. if i change enrollment =25 and max class size = 30 ,,, i want that change in table 2 .......so i want that table 2 should display Enrollment = 25, max class size = 30 ,I want this things in TABLES not queries , what should i do... and i compulsory have to use access... NOT EXCEL.
2) then i want that Total Incomer per class (In Table 2) = Enrollment * Income per enrollment so that value should be display on total incomer per class ....So if i change enrollment value ... then the total income per class value has to change ....
3) i want in table that my total income in all class should display in same table ( Table 2)
I Have a table with 15000 entries. This table lists components we use. This table is used to generate queries/forms. I have been asked to add a hyperlink to this table to link to a drawing of the component. All the drawings are in PDF and in the same folder. I am looking for a way to automatically update the hyperlink fields all at once. The Hyperlink will be in the format of servershareddrawings12345.pdfwhere 12345 is the component name from the table.
But there are a few small problems with the component names. 1. If the component begins with a B- . The drawing name will be all the characters except when there is a second dash in the component. So if the component is B-12345-678 the drawing name will only be B-12345. 2. If The component begins with AB, The drawing will be the first 5 characters regardless of what follows, e.g. AB123. 3. Finally for all other components the full component name will be the drawing name.
Putting the naming to one side, how to go about auto generating the hyperlink. I have posted this in the table section, but maybe this should be in another section like queries or VBA.
I would like the "DateOfConfirmation" to populate with today's date when "SSurvDiagThisYear" is Confirmed.
The DateRecordCreated is a simple =Date() that populates when the record is entered into the table.
SSurvDiagThis Year is the case outcome - Pending, Probable, or Confirmed. It is possible that the case could be confirmed on the same day it was entered into the table but that is RARE.
I am hoping for the The DateOfConfirmation to capture the date the case is confirmed so that I can gather some duration between the case being opened to confirmed.
I'm able to import new data from excel just fine, but I can't import updated data from excel due to duplicates not being allowed for a particular field. Is there a way to keep from importing duplicate records based on one field, but still import data from other fields where the information is different from the excel file?
I am trying to create a table for income and expense [catergory] and would like the amount being entered into the [amount] field to have a negative or positive value on entering based on the category chosen.
so in my table I have
[catergory] which is chosen from a look up table ( which is either an INCOME or EXPENSE ) [amount] which is entered in the next field ( which has to return a positive or negative value based on the catergory choosen upon entering the data)
I would like to go one step further and indicate this negative value in red is possible in my FORM.