Add one field to an expression in query

  • Thread starter Thread starter Bob Vance
  • Start date Start date
B

Bob Vance

I wanted to add: ' / ' tblInvoice.ClientDetail
at the end of this expression, could someone help me with this....Thanks Bob

OwnerName: IIf(funGetHorse(tblInvoice.InvoiceID,0)='
',tblInvoice.OwnerName+'
'+funGetHorse(tblInvoice.InvoiceID,0),tblInvoice.OwnerName+' /
'+funGetHorse(tblInvoice.InvoiceID,0))
 
Hi Bob,

First off, it may be better to use the concatenate operator, which is
the ampersand (&). That will avoid any confusion as to whether you are
wanting to add or concatenate. Then just add the stuff you want onto the end:

OwnerName: IIf(funGetHorse(tblInvoice.InvoiceID,0)='
',tblInvoice.OwnerName & '
' & funGetHorse(tblInvoice.InvoiceID,0),tblInvoice.OwnerName & ' /
' & funGetHorse(tblInvoice.InvoiceID,0)) & ' / ' & tblInvoice.ClientDetail

Hope this helps,

Clifford Bass
 
Thanks Clifford Billiant,any chance of dropping the '/' if there is a
funGetHorse because if there is a funGetHorse there will be no ClientDetail
so in that case I am getting : Owner / funGetHorse /
regards Bob
 
Thanks, Would be good if [& ' / ' & tblInvoice.ClientDetail] Only appears if
there was no funGetHorse
Regards Bob
 
Hi Bob,

Your are welcome.

If I understand what is going on; try moving the last paranthesis to
the end. However, as I look at it a bit more, you may be able to simplify
the statement. Assuming that you want just

OwnerName

when funGetHorse(tblInvoice.InvoiceID,0)=' '

or

OwnerName / funGetHorse(tblInvoice.InvoiceID,0) / ClientDetail

when funGetHorse(tblInvoice.InvoiceID,0)<> ' ' change your statement to

OwnerName: tblInvoice.OwnerName & IIf(funGetHorse(tblInvoice.InvoiceID,0)='
', '', ' / ' & funGetHorse(tblInvoice.InvoiceID,0) & ' / ' &
tblInvoice.ClientDetail)

Clifford Bass

Bob Vance said:
Thanks, Would be good if [& ' / ' & tblInvoice.ClientDetail] Only appears if
there was no funGetHorse
Regards Bob


Bob Vance said:
Thanks Clifford Billiant,any chance of dropping the '/' if there is a
funGetHorse because if there is a funGetHorse there will be no
ClientDetail
so in that case I am getting : Owner / funGetHorse /
regards Bob
 

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

Similar Threads


Back
Top