Converting Iif To Case
Oct 10, 2006
Hi here is the original code
MAX(IIf([Book]='C',[Score]," ")) AS CScore,
Max(IIf([Book]='C',[PercentileScore]," ")) AS CPercent,
Max(IIf([Book]='C',[PassFail]," ")) AS C,
Max(IIf([Book]='D',[Score]," ")) AS DScore,
Max(IIf([Book]='D',[PercentileScore]," ")) AS DPercent,
Here is what I thought may work, but it seems like there should be an easier way
Case when Max ([Book]) = 'C' then [Score] else null as CScore,
Case when Max([Book]) = 'C' then [PercentileScore] else Null as CPercent,
Case when Max ([Book]) = 'C' then [Passfail] else Null as C,
Case when Max([Book]) = 'D' then [Score] else Null as Dscore,
Case when Max ([book]) = 'D' then [PercentileScore] eslse Null as DPercent,
Thanks
K
View Replies
ADVERTISEMENT
Apr 27, 2005
I am trying to change all the fields of a table from All Caps to Propercase. I have used strconv propercase before, however only on a field by field basis. I have about 5 or tables that I have to do this to and am trying to save the typing. I know I can do this with a recordset (easily in asp), but am not familar enough to do this in vba. Can you do a for each fld, like in asp, or am I going at this the totally wrong way. I tried using an update query with the *, but access doesn't like that too much. Any help is greatly appreciated.
Thanks,
Josh
View 1 Replies
View Related
Mar 16, 2013
Is there any way of making data that is inputted in lower case to automatically change to the first letter of each word being a capital ...
View 4 Replies
View Related
Aug 24, 2004
hi
help is needed yet again :-)
I know when creating a text field in the format option
you can use the > or < sign so that when text
is entered it automatically changes it to uppercase or
lowercase - but i need it to be Title Case, any one know
how I can do this....
View 11 Replies
View Related
Apr 7, 2006
I have an Option Box that contains three Report Choices, Report1, Report2 and Report3. I want to run the Reports. I coded using If-Then and it worked out fine. See code below:
Private Sub Frame0_Click()
If Me.Frame0 = 1 Then
DoCmd.OpenReport "Report1", acViewPreview
ElseIf Me.Frame0 = 2 Then
DoCmd.OpenReport "Report2", acViewPreview
Else
Me.Frame0 = 3
DoCmd.OpenReport "Report3", acViewPreview
End If
End Sub
I would like to get the same result using "Case." However, when I use the Case format, it does not show all the reports as it does in the IF -Then format. See Case format below:
Private Sub Frame1_Click()
Dim Test As Integer
Select Case Test
Case Me.Frame1 = 1
DoCmd.OpenReport "Report1", acViewPreview
Case Me.Frame1 = 2
DoCmd.OpenReport "Report2", acViewPreview
Case Me.Frame1 = 3
DoCmd.OpenReport "Report3", acViewPreview
End Select
End Sub
Something simple is missing at the top. Please advise as to how to correct this?
View 3 Replies
View Related
Sep 28, 2004
Someone was helping me out and sent me the attached code to connect to a SQL server from Access2000 in a query. Access doesn't use the CASE statement, but the IIF statement instead. Can any of you help in deciphering the below CASE statement into an IIF statement?....
View 2 Replies
View Related
Jul 24, 2005
Can I use a [system number] value stored in a table in a select case?
Select Case [system number] "Tble system numbers"
Case 42144
do this
Case 88754
do this
???
Jon
View 6 Replies
View Related
Jul 26, 2005
I have this code in an event property on a report and it is working great. However, I now need to do a second case based on which modules are down. Is it possible to have a select case within a select case? I have the select case for the systems now with in each system I need a select case based on modules?
Dim dbs As DAO.Database
Dim rst AS DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Select * From YourTable")
While Not rst.EOF And Not rst.BOF
Select Case rst![System Number]
Case 42144
' do this
Case 88754
' do this
Case Else
' do this
End Select
rst.MoveNext
Wend
rst.Close
Set rst = Nothing
Set dbs = Nothing
View 4 Replies
View Related
Jan 1, 2007
How can I set up a table so that as we assign a case it generates a new number with the year in front of it. I would like for the case number to be generated by the program and when someone enter a new case the program generates the next case number and assignes it to that case. The format we use for our file numbers are year-XXXX (ex: 07-0001). With the new year I'm trying to set this up so that as we start the year the computer will generate the new number.
View 1 Replies
View Related
May 2, 2007
Any ideas how to Capitalise data in a table.
View 14 Replies
View Related
May 23, 2005
Hi,
I am trying to run the following query and getting an error. It looks like its because of the Case Statement.
SELECT Role.RoleID, Objects.ObjectID,
CASE MID(Objects.ObjectName, 4, 2)
CASE 'SR'
0
CASE ELSE
2
END AS AccessType
FROM Role, Objects
WHERE (Role.RoleID > 2115)
Can you give me suggestions plzzz
Thanks,
View 2 Replies
View Related
Jun 28, 2005
Hi everybody,
I'm having quiete a problem with the case instruction. I have the folowing query:
Select station, count(case poc_1 when 1 then 1 end), count(case poc_1 when 2 then 1 end)
From poc
group by station
Well Acces tells me there is a syntax error in the case instruction???Can't find!!!Can anybody help? Tanx
View 4 Replies
View Related
Jun 29, 2005
Hi,
I'd like to know if the keyword CASE, or IF... is recognized in Access (sql) queries.
If not, wat should I do to implement a condition, in a query or in the source of a textbox in a report ?
The problem : I have a report that use this query in a calculated field, and I want to avoid results that are equal to zero (i.e.divising by zero).
Thanks :)
Twinpath
View 3 Replies
View Related
Oct 24, 2007
I have two tables that have fields set to a text so that the ClientID is their name.
When I query, my queries don't take into account the case. So "K Smith" is the same as "K SMITH" as "k sMIth"
I am trying to write an unmatched query between two tables based on this ClientID but it will turn up no unmatched because it is not taking into account the case.
Any suggestions on how to match the cases, othere then changing the table?
Thanks.
View 1 Replies
View Related
Dec 19, 2007
Hello, I'm attempting to use a case statement in order to select fields from a column that have names and addresses mixed. I'm wanting to select only the fields that contain names. For example some fields start with an address of "1998 Sky Rd" or PO BOX, or Suite at the beginning of the field. I would like to first select all fields with names in the field and then use an update statement to move/switch fields to another column. The only problem is that I can't seem to get this query to work. Please help!!!
Thank you!!!!!!!!!
SELECT address1, name3=address1 as expr1
Case [address1]
When mid([address1],1,1) Like [A-Z] then [address1]
When [address] is null then ""
When [address] = "" then ""
Else 'Null"
End,
FROM Exercise1;
:confused:
View 9 Replies
View Related
Mar 21, 2005
i have a form, and i would like that on one of the fields, as soon as i type something in it when i leave the field, i want it to automatically convert it to title case. can this be done please?
Cheers
View 1 Replies
View Related
Oct 27, 2004
New at this and need help!
I am trying to calculate a date in the future based on an entered date and the sample falling into one or more categories.
Fields: Start Date, manually entered
Interval, combo box, choice of monthly or weekly
Pull Interval, combo box, choice of Long term, Short Term, or Stressed
Conditions, combo box, choice of 25°C, 40°C, or 60°C
1 Week, calculated field
3 Month, calculated field
What I would like to happen is that when the Interval box is the choice of monthly that the 3 Month field calculates the date 3 months from the start date. Also, if the Interval field is weekly the 3 Month field is to be left blank.
I have managed the Dateadd function to calculate the 3 month date, but do not know how to incorporate the condition of the weekly statement to leave the 3 month field blank.
Also where should I put this, right now I have this calculation in a subform. Would it be best to generate this in a query? and if so how do I set this up?
Also, I need to select that the Pull Interval is Long term that I can only choose the Conditions field, 25°C, Interval field as Monthly, and only calculate the 3 month time point. Same thing with the Short term and stressed Pull Intervals, I want when they are selected to only allow me to look at fields relative to those conditions.
Any help would be extremely appreciated. I have several books and they are not spelling out exactly what I need, and with my limited programming experience I am stuck.
Thanks
ChrisB37
ChrisB37View Public ProfileSend a private message to ChrisB37Find all posts by ChrisB37Add ChrisB37 to Your Buddy List
View 1 Replies
View Related
Nov 1, 2005
I have a linked table that updates regularly. It stores all words in Upper Case. I would like to mail merge out of a query but I would like to format the words so that the first letter is Upper Case and the rest of the letters are Lower Case. I have tried formating the field in the query but this doen't work.
Any way to do this?
View 7 Replies
View Related
Feb 20, 2006
Can someone put a newby straight please?
Why do I get a 'NAME' error from this?
Many thanks in advance
Don
Select Case SortOrd
Case "a": Me.SortOrd.DefaultValue = "B"
Case "b": Me.SortOrd.DefaultValue = "C"
Case "c": Me.SortOrd.DefaultValue = "D"
Case "d": Me.SortOrd.DefaultValue = "E"
Case "e": Me.SortOrd.DefaultValue = "F"
Case "f": Me.SortOrd.DefaultValue = "G"
Case "g": Me.SortOrd.DefaultValue = "H"
Case "A": Me.SortOrd.DefaultValue = "B"
Case "B": Me.SortOrd.DefaultValue = "C"
Case "C": Me.SortOrd.DefaultValue = "D"
Case "D": Me.SortOrd.DefaultValue = "E"
Case "E": Me.SortOrd.DefaultValue = "F"
Case "F": Me.SortOrd.DefaultValue = "G"
Case "G": Me.SortOrd.DefaultValue = "H"
'Case Else
'Me.SortOrd.DefaultValue = "Oops"
End Select
View 2 Replies
View Related
Apr 25, 2005
I have a drop down list box on my form called FieldA. I would like for FieldB to update with a number depending on what is in FieldA. For example, if FieldA has Red, I would like FieldB to return a 2. I know this needs to have a case function done, but how do I get it linked to FieldB?
View 2 Replies
View Related
Oct 2, 2005
Greetings all,
done a quick search and came up empty handed
what is the best way to use 'or' in a Case statement. I am using
Case "14" or "15"
however it only seems to recognise the first number not the second. Sometimes it does not recognise either number.
~rbinswe
View 4 Replies
View Related
Oct 12, 2005
Hello Everyone,
Why does my database grow so large during the development stage?
After compacting the database it is 64 megs, but only after a small number of changes it grows to 500 plus and more if I don’t re-compact it.
There is only one small graphic inserted into it.
View 5 Replies
View Related
Feb 23, 2006
Hi
I have a simple database where I wish to force only Upper Case text even if user inputs Lower Case text, how can I do this?
ViRi
View 5 Replies
View Related
Feb 28, 2006
Hi everyone, please help, i am in depserate need here. Am i right in thinking nested IF functions are limited to 7 variables, i need to choose from 12, so i need to use something different
it seems like a CASE function could do what i want it to, but i really have no clue where to start, shall i enter this into a query criteria box, or on the form itself ina new field box...??
Can you give a few hints as to what the code would look like, i have two fields, obviously. One is 'lesson_type' and one is 'cost' i want the cost to change depending on what is selected in the lesson type box.
LESSON TYPE ----------- COST
Beginner 1hour ----------- 15
Beginner 2hour ----------- 29
Beginner 3hour ----------- 42
Test Retake 1hour -------- 13
Test Retake 2hour -------- 25
Test Retake 3hour ---------36
Disqualified Retake 1hour -- 25
Disqualified Retake 2hour -- 49
Disqualified Retake 3hour -- 72
Advanced 1hour ---------- 10
Advanced 2hour ---------- 19
Advanced 3hour ---------- 27
Is it possible to do that, change the cost correpsonding to what one is entered in lesson_type...??? And where do i put it??? What do i do with it??
Thanks, dragon2309
View 4 Replies
View Related
Apr 12, 2007
This is kind of a weird question. I downloaded and imported a table with cities and zip codes in it. All the city names are in upper case. I want to use the city names in that table as the row source for my City text box.
But in my database, I store city names in Proper Case, with just the first letter capitalized. So when I use the table as the row source, it pulls in the city name all in upper case
Is there a way, either within Access or not, to change the city names in that table to Proper Case?
View 4 Replies
View Related
May 29, 2007
Hi
I have imported a large contacts table from an old database. The Name field has had all the names input as JOE BLOGGS etc. I can force the table to read joe bloggs etc using < in the format box in properties for this field. But I want the names to read in the Joe Bloggs format, first letter in each name being upper case. Is there an easy way of doing this.
Just got back in to databases after 15 years so wee bit lost at the moment.:o
regards
TP
View 1 Replies
View Related