Query returning a blank result?

  • Thread starter Thread starter Rashar S via AccessMonster.com
  • Start date Start date
R

Rashar S via AccessMonster.com

Hi.

I have a table called tblCustomer and a table called tblSales. My table
customer has a Cust_Contact column that has some blanks in it. My tblSales
table has an Owner, Service_Contact and a Sales_Contact columns.

What I want to do is have my query look at the tblCustomer table, and if
there are any blanks, assign either the Owner, Service_Contact or
Sales_Contact to the tblCustomer.Cust_Contact column.

Here is what I have thus far:

Contacts: IIf([tblCustomer].[Cust_Contact]=" ",[tblSales].[Owner] or
[tblSales].[Service_Contact] or [tblSales].[Sales_Contact],[tblCustomer].
[Cust_Contact])


Thanks in advance,

Rashar
 
Define "blank". I expect you mean Null (no value). If so, try something
like:

Contacts:
Nz([tblCustomer].[Cust_Contact],Nz([tblSales].[Owner],Nz([tblSales].[Service_Contact]
,Nz([tblSales].[Sales_Contact],[tblCustomer].[Cust_Contact]))))

I might have missed a comma or ) but you should be able to fix it.
 
Hey Duane,

Thanks for your help. What I mean by blank, is indeed null values. Your query
returned exactly the values that I am looking for. I didn't know that I did
not need an iIF statement for that type of query...

Regards,

Rashar

Duane said:
Define "blank". I expect you mean Null (no value). If so, try something
like:

Contacts:
Nz([tblCustomer].[Cust_Contact],Nz([tblSales].[Owner],Nz([tblSales].[Service_Contact]
,Nz([tblSales].[Sales_Contact],[tblCustomer].[Cust_Contact]))))

I might have missed a comma or ) but you should be able to fix it.
[quoted text clipped - 15 lines]
 
Nz() is a specialized IIf().

--
Duane Hookom
MS Access MVP
--

Rashar S via AccessMonster.com said:
Hey Duane,

Thanks for your help. What I mean by blank, is indeed null values. Your
query
returned exactly the values that I am looking for. I didn't know that I
did
not need an iIF statement for that type of query...

Regards,

Rashar

Duane said:
Define "blank". I expect you mean Null (no value). If so, try something
like:

Contacts:
Nz([tblCustomer].[Cust_Contact],Nz([tblSales].[Owner],Nz([tblSales].[Service_Contact]
,Nz([tblSales].[Sales_Contact],[tblCustomer].[Cust_Contact]))))

I might have missed a comma or ) but you should be able to fix it.
[quoted text clipped - 15 lines]
 
Back
Top