Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with IIF. Null values required when cbo =....... 1

Status
Not open for further replies.

aarondewberry

IS-IT--Management
Joined
Jul 20, 2005
Messages
148
Location
GB
All

I am trying to use a combo box to pull null records from a table , when the combobox = "Not Allocated". Else if a name is chosen from the same combo i.e "dave";"Bob" etc... then i want to pull only those records.
I have had a search around the FAQ's, threads etc and have found similar threads. But I don't know enough about IIF's to incorporate them to what i'm trying to do.
Thanks in advance.
 
What are you using to get the records? A form, table, query, recordset ...?
 
I am trying to write a query to get the records using the cbo from my form. So basically, after either the persons name or 'not allocated' is selected from the cbo, i then want to open the query with the results. Null values for 'Not allocated' ....
Thanks
 
Also, this is how i tried to write the iif!
Code:
IIf([forms]![frmAdWA]![cboUserName]="Not Allocated",[Agent] Is Null,[forms]![frmAdWA]![cboUserName])
 
Will it suit like so:

... WHERE Trim([Agent] & "")=IIf([forms]![frmAdWA]![cboUserName]="Not Allocated","",[forms]![frmAdWA]![cboUserName])

This will include zero length strings and Null.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top