Nested Queries And Forms

Jul 23, 2007

Hey,

I am working on my first access project (please be patient and try to explain like to a child). My problems however are past the basic level so please bear with me ....

I am working on a datbase which deals with laboratory data from patients which have different date stamps - ie. each record has a 'valid time' (time of blood drowing) a 'transaction time' (time of entry into the DB) and 'delete time' (deleted recordes are just given a date and not really deleted).

The idea is that the user should be able to watch the status of the DB at different past dates (ie what did the doctor know about a patient blood tests a month ago when he made the decision to give him a medication which eventually harmed his kideneys). The user should also be able to change values of records, delete records (which means to add a date to the deleted date field) and to add new records.

I want to do it all using one form.

Things I have done so far:
1. Query by form which locates a specific record (Main-Form & singleRecQuery)
2. A subform in Main-Form which displays the results of singleRecQuery (Single-subform). The query and subform aer updated by a macro once I enter all the data into main-form.
3. A qury by form derived from Main-Form which locates a range of values (Range-subfrom & Range-Query)

My problem spans both forms and queries (so I am posting in both forums):
1. I want to create an update query that will draw its data from Single-subform (the form which displays the results of singleRecQuery). I have created the qury without a problem but the fields in the form are locked for entering data (maybe because they are bound). Is there any way to enter data in such a form which is based on a query and then use the new data in another query ? (I tried allowing data entery in the forms properties but it deos't work).

2. I have tried to put a criterion in the queries on the "Delete Date" field so that the quries will not display the deleted records (I have tried "is null" "is empty" and "is missing") but when I run the query with these parameters I get no records back.

3. In the form I have a command buton which runs a macro that runs the qury and then update dthe subform. Is there a way to get this button to run different macros after different events in the form or do I have to add a button for every specific task I want.

4. As I have mentioned the Main-fom is supposed to run 3 differnt queries and display the results on the same form. I know how to make a subform invisable but is there a way to place all three result subforms in the same spot ?

Sorry it is so long
Thanks
EJ

View Replies


ADVERTISEMENT

Problem With Nested Queries

Oct 11, 2004

Hi people ... here 's want i ve been trying to do for ages...

Subtract the result of this query

SELECT sum(tbl_order.sunoloaxias)
FROM tbl_order, tbl_client
WHERE tbl_client.arithmo = tbl_order.onoma_arithmo and tbl_client.arithmo=220;

from this query

SELECT sum(tbl_cash.amount) AS Eκφρ1
FROM tbl_client, tbl_cash
WHERE (tbl_client.arithmo)=220 And ((tbl_cash.pelatis)=tbl_client.arithmo);

I am trying to put it somehow in a nested query but i can t manage... Please send any answers that can help me
Thanks!!

View 3 Replies View Related

Queries :: How To Create Nested Query

Nov 14, 2013

I have done smoe baisc queries to sort, filter and report on data.How do I create a nested query where I don't repeat all the information across the query results line? Is there a way I can build a nested query to give all the SMCode codes associated with each appointment in one column separated by a coma?I have a table with appointments (APPTS):

RecID
ADate
ATime
Durantion
PVID
Desc
Case#

Then I have a table with Orders related to these appointments (ORDERS):

RecID
Case#
SMCode
SMDate

Here's my query:

SELECT DISTINCTROW Appts.RecID, Appts.ADate, Appts.ATime, Appts.Durantion, Appts.PVID, Appts.Desc, Orders.SMCode
FROM Appts INNER JOIN Orders ON Appts.[Case#] = Orders.[Case#];

My results look like this:

RecID ADate ATime Duration PVID Desc SMCode
RecID ADate ATime Duration PVID Desc SMCode
RecID ADate ATime Duration PVID Desc SMCode

I need my results to look like this:
RecID ADate ATime Duration PVID Desc SMCode,SMCode,SMCode...

View 3 Replies View Related

Queries :: Nested IIF - Not Getting Correct Value When Add Second Condition

Oct 24, 2013

I am using the IIf function as follows

Exp1:IIf(field A = "a string value",1,0) this returns the correct value.

However when I try to add a second condition using the IIf function, or use the And Or condition, I do not get the correct value.

I am trying to get a value of 1 in the Exp:Col when field B has a value that is different from field A.

What is the correct syntax? What am I missing??

View 13 Replies View Related

Complicated Nested Queries / References

May 8, 2012

I am trying to create a database which crosschecks specifications against building codes. My problem is that it's not feasable to put all of the information about a Building into the Room table, though many codes require information about the Building in order to classify the room. How would I count (or list/get details from) a room in the Rooms table, for use in an SQL statement about the Buildings table.If there are up to 5 rooms in the building, do at least 2 rooms contain a fire escape?

My Rooms table contains information about if the room has a fire escape, as well as references its parent Building ID. How would I query the rooms to count the Rooms within all buildings, and subsequently query all Buildings which have less than 2 rooms with fire escapes?I need it to return a list of the buildings which do not conform to this code.

Now this is literally my second day of programming/working with Access, but I've yet to find an answer dispite hours of searching.I think I can adapt it for the 100+ building codes/references I'll need to implement. It would be perfect to find an SQL-only way of doing this, without going into modules etc...

View 6 Replies View Related

Need Help Fixing Sorting Problem Using Nested Queries

Dec 6, 2006

I have a set of two queries (which I'll call A and B, for convenience). Query A reads a table containing customer order numbers, a sequentially-assigned line number for each item requested by a customer on a particular order, and a part number associated with each order line. The line numbers are not integers, but run out to three decimals - so 1.000, 1.100, 1.150, 1.200, etc. would all be valid line numbers. All Query A does is to sort the table, with the primary (first) sort being order number, and with line number being the secondary (2nd) sort. Each record also contains a field equal to the integer value of the line number, so for lines 1.000, 1.100, 1.150, 1.200, this third value would always be 1; similarly, for lines 2.000, 2.100, and 2.200, the third value would be 2.

Query B uses query A as its source of input, and performs grouping (using the "Group By" function) so that query B's output displays only one record for each unique combination of customer order number and INTEGER line number; the part number displayed on each row of query B's output is supposed to be the part number on the first row of query A's output whose order number and integer line number correspond to each group in query B. (I am using the syntax of "First(Part Number)" in query B to report this.) This seems to be working most of the time, but not consistently; sometimes, for each unique order number / integer line number combination, Query B reports a part number from the wrong row of Query A. So, for example, order 12345, integer line 1, as reported from query B, may report the part number on line 1.300 from Query A, instead of line 1.000 from query A as intended.

Does anyone know a fix for this? I've got a team of anxious coworkers who are hoping for it.

Thanks a lot!

View 1 Replies View Related

Queries :: Getting Parenthesis Error In Nested IIF Query

Apr 15, 2015

I have different product groups and they can have one of 3 rental rates(5,4,3%) I have written a nested query but I keep getting parenthesis errors, the last one I got told me I must enclose iif functions in parentheses. I know its probably a small thing but I just cant see it. By the way the server is German so ; need to be used instead of ,.

IIf([view_India]![Sub_Group] In (1730;1810;2870);5;iif Left([view_India]![Sub_Group];2) In (01;02;21;24;29)
;5;iif([view_India]![Sub_Group] In (3310;3330;3340;3360);3;4))))

View 2 Replies View Related

Queries :: Nested IIF Statement In Date Calculation

Jul 30, 2015

I am trying to calculate the time between two dates where one date field might be blank or not. Where the field is blank I want to use the current date to perform the calculation. So far I have the following but I keep receiving an error message saying that the expression has a function with too many arguments. Is there a simpler solution to this?

IIF([LastOfEnd_Date] IS NULL,(DateDiff(w,[LastOfDischarge_Date],NOW()))/4, IIF(Not isnull([LastOfEnd_Date], Abs(DateDiff("w",[LastOfDischarge_Date].[LastOfEnd_Date]))/4

View 5 Replies View Related

Queries :: Make A Nested If Then Statement In A Query Field

Apr 27, 2014

I'm trying to make a nested if then statement in a query field, and I can't figure out why I can't get my formula to work:

Volume: IIf([MethodCode]="K",[total]*12.54*0.026873,IIf([MethodCode]="S",([length]*[width]*[depth])/2,IIf([MethodCode]="M" And [Location]="SH",[total]*5.08*0.026873,IIf([MethodCode]="M" And [Location]="C",[total]*18.58*0.026873," "))))

I keep getting the "data type mismatch in criteria expression" error. If I separate out all the individual if then statements individually, they work. But if I connect them all as a nested if then it doesn't work.

View 6 Replies View Related

Queries :: Multiple Nested IIF Statements - Output In One Field

Mar 25, 2013

I am trying to get the output of several nested IIF expressions to show in only one filed in the table created. The output needs to be captured in a table. I am staring with create table to get it to work before I go ahead and use the sql to update the original table (the table the data is from)

I can get each to run fine independently and the whole thing runs too, the issue is it wants to put each expression in a new column, thus it is forcing me to label the expression.

Can I change this to only output in one column or add some more sql to do so?

Here is the SQL (table and filed names have been changed to protect the innocent)

BTW, I cannot change the Table the data comes from, I am stuck with the single table structure (BOO).

************************************************** *************
SELECT TABLE1.ID,
IIf([TABLE1]![STAGE]="D",
IIf([TABLE1]![PROJ_ACTUAL_D_DATE] Is Not Null,"Tier 1",
IIf([TABLE1]![APPROVAL_D]="Y","Tier 2",

[Code] .....

View 1 Replies View Related

Queries :: Nested IIF - Returning Calculated Results In A Query

Oct 30, 2013

What is the best approach to returning calculated results in a query. I have been using nested IIf statements that include DateAdd but I think that I am at a point where there must be a better way.

I want my query to calculate a date based on:
1) A Type field from my table
2) A calculated date based on other query fields.

My query has the following fields:
[Type] [Action 1] [Projected Action 1] [Projected Action 1 Revised] [Action 2]

I want to create a calculated field for [Projected Action 2] that says:

If [Type] is "A" then
if [Action 2] Is NotNull, Null
if [Action 1] is NotNull, [Action 1] + 10 workdays
if [Projected Action 1 Revised] is NotNull, [Projected Action 1 Revised] + 10 workdays
if [Projected Action 1] is NotNull, [Projected Action 1] + 10 workdays

[Code] ....

I would like to keep using nested IIf but I keep running into problems and I thought that there is probably a better way.

View 7 Replies View Related

Queries :: Complicated Query (nested Subqueries) For A Trend Graph

Apr 17, 2014

Some essential background first. I have a Balances table which records balances by date. I also have an Issues table where problems are logged. There is a one-to-many relationship between Balances and Issues (i.e. each Balance can have multiple Issues). I also have a Comments table where updates for each Issue are recorded. There is again a one-to-many relationship between Issues and Comments (i.e. each Issue can have multiple Comments)

There are two key date fields in the Issues table :FlagDate (the date an Issue was flagged by a user for investigation)

ResolveDate (the date said investigation was brought to a conclusion)

There is also a date field in the Comments table :UpdatedWhen (the date any given comment was added)

So the basic flow is that an Issue gets flagged (FlagDate), then various comments are added (multiple UpdatedWhen's) and finally the Issue gets resolved (ResolveDate)

I need to incorporate a trend graph which will show the counts ofNew (i.e. new issues flagged as of each day) Cleared (i.e. issues resolved each day)

Updated (i.e. issues not yet resolved but updated each day)

Unchanged (i.e. issues not yet resolved and not updated each day)

Outstanding (i.e. all unresolved issues as of each day)

This is the SQL I've put together to get that table of information on which to base my chart :

Code:
SELECT [tblBalances].[BalanceDate] AS AsOfDate,
(SELECT COUNT([tblIssues].[IssueID])
FROM [tblIssues]
WHERE [tblIssues].[Flag] = True
AND [tblIssues].[FlagDate] = [tblBalances].[BalanceDate]) AS New,

[Code] .....

The subqueries for 'New', 'Cleared' and 'Outstanding' work perfectly; the resultant dataset gives me one record for each date in the Balance table and correctly counts the number of issues falling into each of those buckets.

The problem I have is with the 'Updated' bucket. If a flagged issue happens to be updated twice on the same day (which is perfectly acceptable), it counts this twice as well. I don't want this as I just want to know how many issues were updated on any given day - not how many updates there were.

I tried using COUNT(DISTINCT) in the 'Updated' subquery but it gives me a syntax error - on further research, I don't think it's possible to use the DISTINCT keyword in a COUNT subquery (at least not easily)

I also tried grouping by IssueID within that 'Updated' subquery but it still gives me the duplicate count within the same IssueID (and returns nulls rather than zeroes for those days where no updates occured)

I think I need to add a subquery within the subquery () to only return the latest comment as of the date in question - something along the lines of :

Code:
(SELECT TOP 1 [tblComments].[UpdatedWhen]
FROM [tblComments]
WHERE [tblComments].[IssueID] = [tblIssues].[IssueID]
AND DateValue([tblComments].[UpdatedWhen]) <= [tblBalances].[BalanceDate]
ORDER BY [tblComments].[UpdatedWhen] DESC) AS UpdatedWhen

But how to do this, nor if it is even feasible in Access to begin with.

View 2 Replies View Related

Queries :: Search Form That Fetches Records In Nested Tables?

May 25, 2014

I have three tables, tblPeople, tblAddresses and tblVehicles. I have a form called frmPeople that shows a single person record, and has subforms with the list of addresses and vehicles for that person (each record has several). I want to create a single search form with each of the fields in my tblPeople, tblAddresses and tblVehicle tables, and allow the user to type anything into any of the fields on the search form, and have the search form fetch records that match.

So far, I have the query built, and the tables all linked the right way (I think), and I have all the search fields coded. And it works GREAT... except for this one little issue: If I do a search, and I put "Smith" in the last name field, I will get several Smiths in my search result, one for each address and vehicle combination. In other words, if I have ONE Smith in the table, and two vehicles and two addresses for that Smith, the query results give me FOUR Smiths! One with Vehicle1 and Address1, one with Vehicle2 and Address1, one with Vehicle1 and Address2, and one with Vehicle2 and Address2.

What I would LIKE is to have ONE record in the query results, and that record shows me that one Smith. And if I then search for "Plymouth" in the VehicleType field, and I have Smith in the name field, I'll get ONE record, and it will be the one of Smith with his Plymouth (Vehicle2).

Here is how my query looks right now (this one ONLY has the last name and vehicle search function to save space), and this is the one that gives me multiple results (which I do NOT want, unless multiple PEOPLE match the search criteria):

Code:
SELECT DISTINCTROW tblPeople.LastName, tblPeople.FirstName, tblPeople.PersonID, tblAddresses.Address, tblVehicles.Vehicle, tblVehicles.Plate, tblVehicles.VehicleYear
FROM tblPeople LEFT JOIN tblAddresses ON tblPeople.PersonID = tblAddresses.PersonID
WHERE (((tblPeople.LastName) Like "*" & [NameField] & "*")
AND ((tblVehicles.Vehicle) Like "*" & [VehicleField]));

Did I write the query wrong?

View 4 Replies View Related

Forms :: Nested Subform Control Value

Jun 19, 2014

I have a main form (frm_main) in which I have a subform as a datasheet (frm_sub1).In the first sub form I have a second (nested) subform (frm_sub_sub2) as a datasheet as well.

On the main form I have an unbound text box which gives me the value of the ID field in the nested subform (frm_sub_sub2).In the main this works well, however, I hit a problem at a particular point.

If I expand an entry in the first subform (frm_sub1), then, in the main form (frm_main) I get the first ID value from the corresponding records in the nested subform (frm_sub_sub2) as expected, which then changes as I scroll through the expended records.

However, if I then expand another entry in the first subform (frm_sub1) without collapsing the previous entry, the ID value shown on the main form (frm_main) from the nested subform (frm_sub_sub2) remains the same and doesn't change to the currently selected record. Even if I then collapse the first selected entry on frm_sub_sub2 - the original ID value still remains on the main form (frm_main).

View 1 Replies View Related

Queries :: Nested Query - Left Outer Join Not Returning All Records

Oct 1, 2014

I have a simple nested query that is not working as expected. My inner query returns 102 records but when I run with outer query I only get 96 records. Below is my query, I don't really want to pull the same fields from both tables but I was doing to test. The values that are missing are those that don't exist with the monthenddate 8/31/2014 - a left join should fix that but doesn't seem to be working ..

Code:

Select distinct a.entity, a.gl_account,a.profit_center,[Open Items_1].profit_center,[Open Items_1].gl_account,[Open Items_1].entity
from(
SELECT DISTINCT [Open Items].entity, [Open Items].gl_account, [Open Items].profit_center
FROM [Open Items]
)a
left outer JOIN [Open Items] AS [Open Items_1] ON
(a.profit_center = [Open Items_1].profit_center) AND (a.gl_account = [Open Items_1].gl_account) AND (a.entity = [Open Items_1].entity)
Where ([Open Items_1].MonthEndDate=#8/31/2014#)

View 1 Replies View Related

Forms :: Syntax For Nested Aggregate Functions?

Feb 4, 2014

I have a problem with a nested arrangement of Right, DLookup and DMax functions.

The function is for a default value in a text control

=Right(DLookUp("[SampleNumber]","tbldat14A_MasterSampleList","[SampleID]=" & DMax("[SampleID]","tbldat14A_MasterSampleList"))+1000001,6)

I am trying to retrieve the last record from a field SampleNumber which is alphanumeric (e.g. "AK005434") and then add a 1 to it as the next SampleNumber. I had previously used a default value in the txtSampleNumber control as

="AK" & Right(1000000+DMax("[Clip]","[tbldat14A_MasterSampleList]")+1,6)

where [Clip] was a field I have calculated in the table to chop off the preceding characters. Adding 1,000,000 and taking the 6 right hand values and concatenating with "AK" gave me the answer, though it is a but primitive.

This all worked until the SampleNumber value got out of order and blocks of SampleNumber values came in that were then followed by blocks of numbers with lower values (say AK005001-AK005050 followed by AK002001-AK002050).

Now I figure if I just recall the latest entry by DLookup and criteria of DMax on the SampleID (Autonumber Primary key) I could get at the value. I have done this to some success using default values in a series of unbound controls like

=DLookUp("[SampleNumber]","tbldat14A_MasterSampleList","[SampleID]=" & DMax("[SampleID]","tbldat14A_MasterSampleList"))

to get the SampleNumber I require, then a Right function to trim in another unbound box and then use that last unbound box as the default value for the txtSampleNumber control that is the entry for the data table. However, the unbound control box is only valid for the first record and does not update. So, I added a macro that closes the form and reopens it. This all works but is a bit agricultural. I would like to do a single nested function to the default value of the txtSampleNumber control box. Is it possible to nest Right, DLoopkup and DMax into one statement?

View 14 Replies View Related

Forms :: Nested IF Statement To Check If Input Box Is Null On Form

May 9, 2014

I have a form in my Access database that has 3 input boxes by which a user can locate a record by. The problem I am running into is that I can not get a nested IF statement to work properly to first check which of the search boxes are filled in and second search by whichever is filled in. I have come up with the following code that seems to be only searching by the first input box. If the first input box is blank it does not move to the second or third numbers so I imagine there may be something wrong with the order of my IF statement or the syntax is off.

View 14 Replies View Related

Modules & VBA :: Table Relationships And Nested Forms - Copy Sub Form Records

Aug 3, 2015

I've attached screenshots of the table relationships and some nested forms that I need to discuss in my database.

If you look at the forms screenshot you'll see I have a main form "business/cmc issues" that uses a combo box to select a business name; nested into that I have a second form "policy issues log" that holds details of policy issues about that business; then inside that I have a sub form "issue updates" that records brief details about the actions carried out in trying to resolve each policy issue.

The same policy issue can affect more than one business (because of a relationship between the two companies etc) but still needs to be viewed separately. So for example in the business selector combo box I might have business "ABC". In the policy issue it might say "doesn't pay on time". The "doesn't pay on time" issue might also apply to business "123" and so if I picked that business from the combo box you'd see the same policy issue.

Because it's the same issue for two separate businesses, the actions carried out will be the same, so what I want to do is, after a new action is carried out (where relevant) to be able to click a button that would run some code that copies the actions entered in the sub form for business ABC and pastes them into the sub form for business 123 where the product area and policy issue are equal. This is to avoid having to enter the same data twice.

View 3 Replies View Related

Forms :: Syntax To Refer To A Control On Nested Subform In Access 2013

Mar 20, 2014

I have searched to find the correct syntax to refer to a combo box control on a nested subform. All the examples I've found Access 2013 will not recognize or find the appropriate control.

I have a parent form called IncidentDetails. On that form I have a control called ctrlLogDetail. Within that control is a form called sfrm_LogDetail. On sfrm_LogDetail, I have a control called ctrlType which houses a form called sfrmType. On sfrmType, I have a combo box called cboType. I need to be able to place the cboType choice into a query to filter records for another combo box on that same form. the query works appropriately when I have sfrmType open, however as soon as I try to call the query from the IncidentDetails form, Access cannot find the cboType control.

I've tried multiple variations of the syntax to call to cboType that I've found online. I found a very useful reference from BTA Development: however the syntax there will NOT work in Access 2013.

What is the appropriate syntax would be to get to my control within my 3 deep nested subform? I'm working Access 2013 and won't have a choice regarding Access versions.

View 5 Replies View Related

Question About "nested" Queries

Nov 15, 2006

I have two tables. I run a query matching certain fields between the tables and create a temp table. What I then want to do is take the same two tables, but matching against different fields, pull out from these tables everything that is not in the temp table.

Here are my table layouts:
TableA: TableB:
PartNumber PN
FSCM ATAPN
ManufactPN FSCM
SPN

I run this query:
SELECT TableA.PartNum, TableB.PN, TABLEB.ATAPN, TableA.Fscm, TableB.FSCM, TableA.ManufactPN, TableB.SPN INTO PartsTemp
FROM TableA LEFT JOIN TableB ON (TableA.ManufactPN = TableB.SPN) AND (TableA.Fscm = TableB.FSCM) AND (TableA.PartNum = TableB.PN)
WHERE (((TableB.PN) Is Not Null) AND ((TableB.ATAPN) Is Not Null) AND ((TableB.FSCM) Is Not Null)) OR (((TableB.PN)<>" ") AND ((TableB.ATAPN)<>" ") AND ((TableB.FSCM)<>" "));

After running that query, I next want to pull from Table A the same fields but only for those records that match PartNumber to ATAPN, FSCM to FSCM, ManufactPN to SPN and that don't have a part number in the PartsTem table I just created.

I'm going bonkers trying to wrap my head around this!!! Can anyone help out a frustrated geek? Thanks so much to those replying....this forum is great!!

View 1 Replies View Related

Nested If (I Think)

Sep 9, 2005

Hi

I have just designed a central training database to aid in the running of our training department.

One section is for an IT course which contains 8 modules.

The tests have the following IDs

Mod 1: ID05, ID06, ID07, ID08
Mod 2: 2.1, 2.2, 2.3, 2.4
Mod 3: 3.1, 3.2, 3.3, 3.4
Mod 4: 4.1, 4.2, 4.3, 4.4
Mod 5: 5.1, 5.2, 5.3, 5.4
Mod 6: 6.1, 6.2, 6.3, 6.4
Mod 7: 7.1, 7.2, 7.3, 7.4
Mod 8: 55, 56, 57, 58

One person may take any of the tests.

If someone completes Mod1, 2 and 7 they achieve Level 1

Similarly if someone completes Mod 3, 4, 5, 6 and 8 they achieve Level 2.

I need to run queries to find who has completed L1 or L2 or both.

Obviously they only achieve if they pass so in that table there is a status field with

Pass
Fail
Wait

As the options

Queries have never been my strong point and I was hoping someone here could help me.

I’m using XP Pro, with Office 2003 and the office 2000 db format.

Many thanks

Dazzy

View 1 Replies View Related

Nested IIF

Oct 26, 2006

Hi

how would one go about nested IIF

New Sal : IIf([emplsalaryaa]>80000,([emplsalaryaa]+([emplsalaryaa]-80000)/(100)*9)+7713.98)

i have the above but i need to put one more

iif

i have tried , IIF but it does not work

i don't know why?

Asad

View 3 Replies View Related

Nested IIF

Jun 8, 2007

My first post ever... so here goes.

My Goal:

Columns of data contain date fields & "Status" that indicates where a case lies. I'm trying to calculate days spent in a specific area (determined by status code) and total amount of time spent there all together. Status code begining w/ "I***" means case was sent to an area, w/ "R***" it returned. I have it together up to a point. My problem lies with end of expression where I want to calculate last date at specific location to now. In line 1 it would be from 5/03/07 to now since no r162 follows & blank field follows. Problem is with second IIF - it acts independently instead of giving false value from first IIF... i think.

status1 date1 status2 date2 status3 date3 status4 date4
1) I162 5/3/07 I004 5/20/07 I006 6/1/07
2) I162 4/2/07 R162 4/30/07

My failure:

stat2n4: IIf([status2]="i162" Or [status2]='i062' Or [status2]='i009' Or [status2]='i159' And [status3]<>'r162' Or [status3]<>'r162' And [Status4]="r162",DateDiff("d",[date2],[date4]),IIf(IsNull([status4]),DateDiff("d",[date4],Now())))

View 9 Replies View Related

Nested Tab Controls

Oct 3, 2005

I have placed a tab control within a tab control (which I have done before). The problem is that the sub tab control appears on every page of the main tab form (encountered this before). I fixed it in the past by placing code on the on open event to make the sub tab control not visible unless the appropriate tab is selected. That worked fine.

I have tried this in the new program and find that when I set the value of the main tab form to 4 (the page index of the tab) the sub tab form will not display at all. However if I set it to zero it will display regardless of which tab is selected. Confusion has now set in :confused: . Any thoughts out there on what I have done incorrectly.

[/CODE]Private Sub Form_Open(Cancel As Integer)

'Me.OrderBy = "RankNo desc"
'Me.OrderByOn = True
If TabCtl44.Value = 4 Then
TabCtl144.Visible = True
Else
TabCtl144.Visible = False
End If
End Sub[CODE]

View 5 Replies View Related

Nested IIf Nightmare

Oct 20, 2006

Poor old Access. I think I've made it wave a white flag, but based on the following expression I am trying to get it to evaluate, I'm not too surprised...

The situation is that I have a large number of tick boxes on a form, which nicely filter through to a series of fields in a table whose values are either -1 or 0 (according to if the box is ticked or not). Unfortunately, I now need to generate a small piece of text for a report based on which boxes have been ticked. Deep breath...

institution:
IIf([people].[memctf]=-1,"CTF",(
IIf([people].[memwt]=-1,"Westcott",(
Iif([people].[memwy]=-1,"Wesley",(
Iif([people].[memry]=-1,"Ridley",(
Iif([people].[memwm]=-1,"Westminster",(
Iif([people].[memiocs]=-1,"IOCS",(
Iif([people].[memermc]=-1,"ERMC",(
Iif([people].[memmbi]=-1,"Margaret Beaufort Institute",(
Iif([people].[memcjcr]=-1,"CJCR",(
Iif([people].[memcym]=-1,"CYM",(
Iif([people].[memindepba]=-1,"Independent BA",(
Iif([people].[memhmc]=-1,"Henry Martyn Centre",(
Iif([people].[memregchelm]=-1,"Regional (Chelmsford)",(
Iif([people].[memregnor]=-1,"Regional (Norwich)",(
Iif([people].[memregpboro]=-1,"Regional (Chelmsford)",(
Iif([people].[memregalbans]=-1,"Regional (St Albans)",(
Iif([people].[memdiocedsips]=-1, "Diocesan (Eds and Ips)",(
Iif([people].[memdiocnorwich]=-1, "Diocesan (Norwich)",(
Iif([people].[memreg]=-1, "Regional", "Unknown"
)))))))))))))))))))))))))))))))))))))

The logic seemed to work nicely when there were just 3 options in the list, but when I try to enter the above, Access says "the expression you entered is too complex". Poor baby! :D

Does any one have any idea how I can get it to evaluate the data I need?

View 4 Replies View Related

Nested IIF Question

Mar 30, 2007

I have a nested IIF that I cannot get figured out. This is what I have so far:

Hours: IIf([Dept]="10",55,Format(IIf([EorDCode]=" 1",[Regular]/60,[OT]/60),"Fixed"))

The problem is that I need another IIF to differentiate between Regular and Overtime. It needs to do this.

If Dept = 10 Then
55 Regular Hours and 0 Ovettime hours
Else
Format(IIf([EorDCode]=" 1",[Regular]/60,[OT]/60),"Fixed"))

View 1 Replies View Related







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