IFF Function help please

G

Golfinray

I have struggled my guts out studying IFF and str functions over the years
and I still have problems with certain ones. I just have not been able to get
this one to work. I have district name-projectsomething in a field. So it may
be fayeteville-electrical, batesville-roofs, Little Rock-plumbing,
cabot-fireprotection or similar. I would like just to return the school
district name without the -something. Thanks so much!!!
 
K

Klatuu

This doesn't require an Iif statment. This formula will return what you want.

Left(Nz([districtname],"-"),Instr(Nz([districtname],"-"),"-")-1)

If [districtname] is Null, the formula will return a null string ""
 
G

Golfinray

Thanks Fred. That worked great. Golfinray

Klatuu said:
This doesn't require an Iif statment. This formula will return what you want.

Left(Nz([districtname],"-"),Instr(Nz([districtname],"-"),"-")-1)

If [districtname] is Null, the formula will return a null string ""
--
Dave Hargis, Microsoft Access MVP


Golfinray said:
I have struggled my guts out studying IFF and str functions over the years
and I still have problems with certain ones. I just have not been able to get
this one to work. I have district name-projectsomething in a field. So it may
be fayeteville-electrical, batesville-roofs, Little Rock-plumbing,
cabot-fireprotection or similar. I would like just to return the school
district name without the -something. Thanks so much!!!
 
G

Golfinray

Sorry, I meant Dave. Thanks

Golfinray said:
Thanks Fred. That worked great. Golfinray

Klatuu said:
This doesn't require an Iif statment. This formula will return what you want.

Left(Nz([districtname],"-"),Instr(Nz([districtname],"-"),"-")-1)

If [districtname] is Null, the formula will return a null string ""
--
Dave Hargis, Microsoft Access MVP


Golfinray said:
I have struggled my guts out studying IFF and str functions over the years
and I still have problems with certain ones. I just have not been able to get
this one to work. I have district name-projectsomething in a field. So it may
be fayeteville-electrical, batesville-roofs, Little Rock-plumbing,
cabot-fireprotection or similar. I would like just to return the school
district name without the -something. Thanks so much!!!
 
F

fredg

Thanks Fred. That worked great. Golfinray

Klatuu said:
This doesn't require an Iif statment. This formula will return what you want.

Left(Nz([districtname],"-"),Instr(Nz([districtname],"-"),"-")-1)

If [districtname] is Null, the formula will return a null string ""
--
Dave Hargis, Microsoft Access MVP

Golfinray said:
I have struggled my guts out studying IFF and str functions over the years
and I still have problems with certain ones. I just have not been able to get
this one to work. I have district name-projectsomething in a field. So it may
be fayeteville-electrical, batesville-roofs, Little Rock-plumbing,
cabot-fireprotection or similar. I would like just to return the school
district name without the -something. Thanks so much!!!

You're welcome! Anytime. <g>
 

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

Query Help 3
Query Help Needed! 3
Help Please 6
Query Help Please. 1
Form Filtering Help 8
Form Help Please 2
Printing Help 3
Stuck on filter, help Please 3

Top