Insert one of two fields into a new table

G

Guest

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.
 
J

John Spencer

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", "'")
 
G

Guest

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", "'")
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top