If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Insert one of two fields into a new table
I have a table A with data and want to fill another table B with data based
on certain conditions in the first table. If Field A.Author has a value put A.Author and A.Date in feild B.Author, but if field A.Autor2 has a value put it and and A.Date in field B.Author instead. How do i do this? There is one more condition I have to check in both cases: Put parantheses round the result if it is 'Y' like this S_Autor: IIf([A].[Parantheses]='Y';'(' & [A.Author] & [A.Date] & ')';[A.Author] & [A.Date]) I tried to use IIF inside another IIF but it did not work. -- Thank you. |
#2
|
|||
|
|||
Insert one of two fields into a new table
NZ(A.Author2,A.Author) will return the value in Author2 unless it is null. In that case it will return the value in A.Author. SO, try the following expression to see if it returns the desired value. IIF(A.Parantheses = "Y", "'") & NZ(A.Author2,A.Author) & A.Date & IIF(A.Parantheses = "Y", "'") Arts wrote: I have a table A with data and want to fill another table B with data based on certain conditions in the first table. If Field A.Author has a value put A.Author and A.Date in feild B.Author, but if field A.Autor2 has a value put it and and A.Date in field B.Author instead. How do i do this? There is one more condition I have to check in both cases: Put parantheses round the result if it is 'Y' like this S_Autor: IIf([A].[Parantheses]='Y';'(' & [A.Author] & [A.Date] & ')';[A.Author] & [A.Date]) I tried to use IIF inside another IIF but it did not work. -- Thank you. |
#3
|
|||
|
|||
Insert one of two fields into a new table
Thank you John, it works perfect.
-- Thank you. John Spencer skrev: NZ(A.Author2,A.Author) will return the value in Author2 unless it is null. In that case it will return the value in A.Author. SO, try the following expression to see if it returns the desired value. IIF(A.Parantheses = "Y", "'") & NZ(A.Author2,A.Author) & A.Date & IIF(A.Parantheses = "Y", "'") Arts wrote: I have a table A with data and want to fill another table B with data based on certain conditions in the first table. If Field A.Author has a value put A.Author and A.Date in feild B.Author, but if field A.Autor2 has a value put it and and A.Date in field B.Author instead. How do i do this? There is one more condition I have to check in both cases: Put parantheses round the result if it is 'Y' like this S_Autor: IIf([A].[Parantheses]='Y';'(' & [A.Author] & [A.Date] & ')';[A.Author] & [A.Date]) I tried to use IIF inside another IIF but it did not work. -- Thank you. |
Thread Tools | |
Display Modes | |
|
|