IIF With 2 Conditions?
Aug 15, 2007
Hi
Hope someone can help with this. Had a search through the forums but nothing quite the same (although I'm guessing it's a simple one to solve.)
I need to calculate a figure based on 2 criteria. The permutations are as follows
If condition A is less than 20 and condition B is No then return 9
If condition A is less than 20 and condition B is No then return 12
If condition A is greater than 20 and condition B is No then return 13
If condition A is greater than 20 and condition B is No then return 15
Any suggestions?
View Replies
ADVERTISEMENT
Feb 26, 2007
I am trying to write a code that will enable an event to happen if 2 conditions are true, something like:
If [DueDate] >= [CurrentDate] And [EndDate] is Null Then
Event ..... take place
I tried above and did not work
it works only if write one condition of above
how can I set it up correctly
View 5 Replies
View Related
May 26, 2005
I currently have a query which takes its criteria from a form called search. This all works fine, unless the user leaves a field in the search form blank. Then the query has no results.
What I'd like is for a blank field to act as a wildcard.
I guess the reason this doesn't automatically work is that Access (effectively) puts " & " around the criteria taken from a form, so the criteria ends up as " " not (there's a space there!).
I tried entering a criteria in the query that says:
IIF([Forms]![Search]![Date] Is Null,*, [Forms]![Search]![Date]
this doesn't work. For one thing Access edits the * into "*", so it is no longer a wildcard. Secondly, I've never used IIF before, so it's probably wrong anyway...
So, can anyone help me do this?
Even if a blank field cannot be used as a wildcard, any character would do...
View 2 Replies
View Related
Jun 7, 2005
Hi, I have created a Yes/No attribute. Im just wondering if a text boxes visibility can be dependent on the result of this. E.g. If a row is set to yes then the text box will be shown and if it is set to no the text box is made invisible. Thanks for any help
View 7 Replies
View Related
Dec 21, 2007
Hi again :)
Since I am new to Access I am having a problem figuring out how to set the participation conditions (optional or mandatory) for my relationships. I have looked through MS access online and forums, google etc. and found nothing.
I would be very grateful for any help :)
Kind Regards
Marie
View 1 Replies
View Related
Jan 12, 2005
The following SQL statement with 1 where condition works fine, but the Next SQL statement with 2 where conditions does not work, a error message says Run-Time error ‘13’ type mismatch , what is incorrect in the statement when the AND MinID = 15 is added. The table data type in set as number
SQL = "UPDATE MinistryInv2 Set MinID = " & 14 & " WHERE PID = " & Me!ID & ";"
SQL = "UPDATE MinistryInv2 Set MinID = " & 14 & " WHERE PID = " & Me!ID And MinID = 15 & ";"
Phil
View 3 Replies
View Related
Jun 3, 2005
I have set up a querry that gathers information from different tables:
ID | Name | StartDate | EndDate | NbOfDays |
Then, i am using a form to fill up this querry. Normal stuff.
1- How and where can i set a condition so the input of EndDate could not be smaller than StartDate?
2- How and where can i set up and write the formula that calculates the NbOfDays? (meaning number of days worked form start date to end date)
Thank you for helping!
View 5 Replies
View Related
Apr 11, 2006
G'Day:
I have a form that I created that allows the user to input an "ExhibitNo" and then a "PlacingNo" to allow each entry to receive a set monetary amount (based on values in a table).
The "ExhibitNo" has two references linked to it. They are "ClassNo" and "ExhibitorID".
My supervisors want me to make it so that when the "ExhibitNo" is entered on the form that it will not allow a monetary amount.
This is where I started, but it does not work. Does anyone have a better idea?
Private Sub Combo14_AfterUpdate()
Me.Refresh
If [ClassNo] >= 0 >= 5000 Then
If [ExhibitorNo] <= 0 >= 499 Then
If [Placinggrade] = "Blue" Then
[Premium] = [Blue]
End If
If [Placinggrade] = "Red" Then
[Premium] = [Red]
End If
If [Placinggrade] = "White" Then
[Premium] = [White]
End If
End If
End If
If [ClassNo] >= 5000 Then
If [ExhibitorNo] <= 500 Then
If [Placinggrade] = "Blue" Then
[Premium] = [Blue]
End If
If [Placinggrade] = "Red" Then
[Premium] = [Red]
End If
If [Placinggrade] = "White" Then
[Premium] = [White]
End If
End If
End If
If [ClassNo] >= 5000 Then
If [ExhibitorNo] >= 500 Then
[Premium] = 0
End If
End If
End Sub
Thanks
View 1 Replies
View Related
Jan 23, 2007
What I need to do is, not have a form pop up when all the conditions are met. I have 30 some users that log into the db.
I have a form that pops up when the date of the project is past due. to certain users when they log in. I am using the Environ("username") theory, which works very well. But when the user has COMPLETED all the necessary dates, the form still comes up, (but of course it’s blank).
How can I eliminate that problem?
View 5 Replies
View Related
Feb 9, 2008
Hi,
i am trying to open a form if all conditions are met. if the conditions are not met, then they get a flash message and then the user should return to the open form. i have the condition checking working but cannot seem to open the form if ALL conditions are true. i also need to close the form when the new form opens.how could i achieve this? here is my code
Private Sub MidVerifyContinue_Click()
FullNameChk.SetFocus
If FullNameChk = False Then
MsgBox "You Need to have a Full Name to Verify", vbOKOnly, "Message"
End If
If CompNameChk = False Then
MsgBox "You Need to have a Company Name to Verify", vbOKOnly, "Message"
End If
If TradeNameChk = False Then
MsgBox "You Need to have a Trading as name to Verify", vbOKOnly, "Message"
End If
If UTChk = False Then
MsgBox "You Need to have a number to Verify", vbOKOnly, "Message"
End If
If CRChk = False Then
MsgBox "You Need to have a C R number to Verify", vbOKOnly, "Message"
End If
If NIChk = False Then
MsgBox "You Need to have a N I number to Verify", vbOKOnly, "Message"
End If
If PostCodeChk = False Then
MsgBox "You Need to have a Postcode to Verify", vbOKOnly, "Message"
End If
Exit Sub
DoCmd.OpenForm "New Verification Qry"
End Sub
many thanks,
Nigel
View 8 Replies
View Related
Aug 9, 2005
Hi friends,
I had two tables parent(f1) , child(f1,f2,f3).
I had to display f3 value for parent(f1) when f1 has only one f2,
if f2 values are more than one for single f1 and if all f3 values are 0 then
i should display f3 as 0, else if some values for f3 are nonZeros and some are Zeros then
is should display f3 value as '-'.
How to do this?
please any suggestions?
Thanks.
View 1 Replies
View Related
Aug 9, 2007
I am so frustrated right now that I could scream. I have a database which tracks attendance and referrals for a networking organization - it meets weekly on Thursdays. It has a report which displays totals of both attendance and referrals for each weekly meeting for an entire month. The problem I am having is related to the fact that some months have 4 Thursdays and some have 5. If I get my queries to display the meeting dates correctly for the 4-Thursday months, then it displays incorrectly for the 5-Thursday months, and vice versa.
Is there any way to put a criteria on a missing record? If I could have it just populate the 5th week with spaces or null when it doesn't exist for that month, it would make my life a lot easier.
I can send a copy of the database to anyone who thinks they can help. It's too big to post.
View 8 Replies
View Related
Nov 30, 2005
Greetings,
I am a little stumped in logic again
What I am trying to do is the following
If the value is on field is say "OA" then I need an input code of LL0000 or LL00000 in the next field
If the value is say "OT" then I need an input code of LL etc
What is the best way of going about this.
The code is for stock locations in a warehouse.
~rbinder
View 1 Replies
View Related
Mar 23, 2005
I have a filed and I want to find out its length then in the next column i have to add the data like if filed 1's length is 1 then it should be 000+field1.value, if it is 2 then 00+field1.value, if it is 3 then 0+field1.value and so on...any help is appreciated , thanks
View 2 Replies
View Related
Nov 6, 2013
how to do multiple conditions, Nested....I have 6 conditions that i like to check,
Code:
if (condition-1) And
(condition-2) And
(condition-3) And
'[code]....
View 8 Replies
View Related
Sep 10, 2014
I'm trying to create an If/Then statement that needs to match to multiple values. My initial thoughts were to create a list but that doesn't seem to work the way I thought it would.
For example:
If Me.Field = 1,2,5, or 8 Then
Do 'X'
Else IF Me.Field = 3,4,6 or 7 THen
Do 'Y'
Else Do 'Z'
I haven't been able to get the syntax to work right. I'd rather not have to do 'Me.Field = 1 or Me.Field = 2, etc.' but if that's the only way to have it work right, then I guess it'll have to do.
View 6 Replies
View Related
Aug 19, 2013
I cannot get the correct syntax for this. The punctuation for the second where condition is incorrect.
Code:
Me.cboDose.RowSource = "SELECT Label FROM tblLookup WHERE tblLookup.[Med]='" & Me.cboMed & "'" AND tblLookup.[Notes] = "Swallowed"
View 3 Replies
View Related
Apr 3, 2013
I am trying to calculate [current status] based on multiple conditions. for example
Current status = A , if (w>0 and x=0 and y=0 and z=0)
Current Status =B , if(w>0 and x>0 , y=0 and z=0)
Current Status =C , if(w>0 and x>0 and y>0 , z=0)
Current status =D , if(w>0 and x>0 and y>0 and z>0)
Where A,B,C,D are text values and w,x,y,z are dates
View 1 Replies
View Related
Jul 11, 2014
How do I set a field to the table so that it will accept only the number 0 or a 12-digit number ...
View 2 Replies
View Related
Jan 23, 2008
I'm trying to get this query to return all records except those with category: 4 AND issue: 12
Instead I'm always getting ZERO category: 4 and ZERO issue: 12
Should not the parenthesis force this to be taken as a single "WHERE"?
SELECT ASSIGNED_TO, COMPLAINT_NUM, DATE_RESOLVED, CATEGORY, ISSUE
FROM tmptbl_tm_YTD
WHERE (CATEGORY<>4 AND ISSUE<>12);
View 3 Replies
View Related
Feb 21, 2005
I have a search form, that can be opened by both my "product_enquiry" and my "edit_product" form.
When you select a value on the product search form, i want it to open another form at a specific record.
Easy you might think, but what If i want it to work out which form to open.
So if: A button on Edit product was clicked on to open product search, the value found in product search should be loaded into edit product.
But if it was a button on product enquiry, the record should be opened on the product enquiry form.
Can anyone help?
View 3 Replies
View Related
Feb 28, 2005
It's easiest if I take you through step by step. I open a form with a list of students and I have to enter the condtion for a Tutor Group (say I type in 13EN). The form then loads up with all students in 13EN. Then I have a 'Add Student' button which loads up a form with an indivudual students information qith a blank record. Then I press a 'Done' button which closes that form and requeries the Student List form.
My problem is when I requery the form I have to re-enter the condition for 'Tutor Group' i.e. I have to type it in again. Is there any way I can refresh the data from the conditions I have already entered (i.e. for the Tutor group, 13EN) without having to type it in again?
Thanks
View 2 Replies
View Related
Jul 8, 2006
Hello. Can this be done?
I am creating a mini scheduling program, and I have one table that handles all requests (tblRequests), then a second table is the final schedule (tblFinalSchedule). On the table for the requests, I have a field called "locked" that is of type yes/no. The purpose of this field is for a meeting time that is of uptmost importance and that I don't want the program to manipulate it in any way.
Is there a way to program in VBA so that when a button on a separate form is clicked, those records that when the yes/no field is checked (set to true), are copied into the appropriate fields from tblRequests into tblFinalSchedule?
View 1 Replies
View Related
Jan 11, 2005
For some reason, this one is driving me nuts so i would really appreciate some help.
This is kind of complicated to explain but here goes.
I am trying to create a query so that, based on certain conditions certain rows from the Form/Table are either visible or not visible on the report.
I have four fields involved:
Antic Dep$ (Anticipated Deposit Amount)
Antic Loan$ (Anticipated Loan Amount)
Date Dep Booked
Date Loan Booked
Basically i am trying to hide any records that in which the Date Dep Booked and/or Date Loan Booked are older than the current month...
I can think it through logically but cannot get my head around the query.
If Date Dep Booked or Date Loan Booked is not older than current month then show the row;
If Date Dep Booked is older than current month and Date Loan Booked is older than current month then hide the row; unless
If Date Dep Booked is older than current month but Date Loan Booked is not older than current month then show the row; except
If Date Dep Booked is older than current month and Antic Loan$ is zero then hide the row; but
If Date Dep Booked is older than current month and Antic Loan$ is not zero then show the row;
Then i also need to do the reverse for the Date Loan Booked, i.e.
If Date Loan Booked is older than current month but Date Dep Booked is not older than current month then show the row; except
If Date Loan Booked is older than current month and Antic Dep$ is zero then hide the row; but
If Date Loan Booked is older than current month and Antic Dep$ is not zero then show the row;
Phew! That probably makes no sense but i had to try.
Once again, i appreciate any help so that i can keep the remainder of my hair.
Switters
View 1 Replies
View Related
Sep 25, 2014
I do not want to allow the main form record to be submitted unless there is at least one subform entry.Initially I thought it would be as simple as a "Before Update" event which would test the record count of the subform. This works... kind of... not really. It does check successfully, however the conundrum is that if the user has completed the main form and tries clicking INTO the subform to add records, this fires the Before Update event and Cancels the update event.
How can I force a user to complete the subform without running into this issue? I dunno how easy this is to do considering you kind of HAVE to exit the main form to enter the subform, at which point the record HAS to be saved...
View 1 Replies
View Related
Oct 11, 2013
I have a Customer Issue form that writes the following into one table named Table1: Date, Customer Name, Ticket number, Agent, Issue and Comments. This is very simple.
All of this is filled in from a form that has links to 3 other tables for drop downs; Customer Name, Agents, Issues. This is working perfectly.
What I want to be able to do is generate a report based on a date range for a particular agent. Say 9/1/2013 - 9/30/2013 for John Doe.
For the report portion, on the form I have to combo boxes, one for start date, one for end date. I also have a drop down for selecting the agent. When I click a button on the form named Report, It will generate a preview of the report.
Here is the problem. I can get this to generate a report based either on the date range, which gives me all of the agents, or by agent, which gives me all of the dates. I can't get it to do both.
Here is some code that I have on the Report button:
DoCmd.OpenReport "AIReport3", acViewPreview, , "[Agent]=" & Me.Agent
This is the code that will let me choose the agent, but gives me all dates.
If I change this code to this:
DoCmd.OpenReport "AIReport3", acViewPreview, , "[DateRptd] Between #" & Me.cboFrom & "# And #" & Me.cboTo & "#"
It will display all issues in the date range, but gives me all agents.
I was thinking I should be able to combine them with an AND or an & to get it to use both the agent and date fields, but I can't get this to work.
Something like: DoCmd.OpenReport "AIReport3", acViewPreview, , "[Agent]=" & Me.Agent And "[DateRptd] Between #" & Me.cboFrom & "# And #" & Me.cboTo & "#"
or
DoCmd.OpenReport "AIReport3", acViewPreview, , "[Agent]=" & Me.Agent & "[DateRptd] Between #" & Me.cboFrom & "# And #" & Me.cboTo & "#"
View 3 Replies
View Related