Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-26-2002, 11:57 AM   #1
pungentSapling
NeedHotSauce?
 
pungentSapling's Avatar
 
Join Date: Apr 2002
Location: Cambridge Ont Canada
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
pungentSapling
criteria expression?

why does this expression not work?
it is the criteria in a query

I am trying to make the query return everything in the field if nothing is selected in the combo box where the criteria comes from.

IIf(IsNull([Forms]![frmVendors]![cboComponent]),"",([Vendor].[Component]) Like "*" & [Forms]![frmVendors]![cboComponent] & "*")

it is not giving errors but it comes up with no results


oyy my head

this much works
Like "*" & [Forms]![frmVendors]![cboComponent] & "*"


Last edited by pungentSapling; 09-26-2002 at 12:07 PM.
pungentSapling is offline   Reply With Quote
Old 09-26-2002, 12:25 PM   #2
Krysti
Registered User
 
Join Date: Sep 2002
Location: Illinois
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Krysti
I may not be understanding exactly what you're trying to do, so if I am off base, just ignore my response

Try putting in the criteria your combo box name and then underneath that in the next criteria (for the OR) put in your combo box name and Is Null:

[Forms]![frmVendors]![cboComponent]
[Forms]![frmVendors]![cboComponent] Is Null

That way if something is selected in the combo box, it should return that record. Otherwise, if nothing is selected it should return all records.

Hope this is what you're looking for!

Krysti
Krysti is offline   Reply With Quote
Old 09-26-2002, 12:42 PM   #3
pungentSapling
NeedHotSauce?
 
pungentSapling's Avatar
 
Join Date: Apr 2002
Location: Cambridge Ont Canada
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
pungentSapling
thanks for the reply I found another way to accomplish what I was after..


Private Sub cboVendor_GotFocus()
If IsNull(Me.cboComponent.Value) Then
Me.cboVendor.RowSourceType = "Table/Query"
Me.cboVendor.RowSource = "tblVendor"
Me.cboVendor.ColumnCount = "3"
Me.cboVendor.ColumnWidths = "0,0,1"
Else
Me.cboVendor.RowSourceType = "Table/Query"
Me.cboVendor.RowSource = "qryLimit"
Me.cboVendor.ColumnCount = "2"
Me.cboVendor.ColumnWidths = "1,0"
End If
End Sub
this way if the combo box is null then the other cboBox uses a different RowSource....the original table instead of the dynaset
your way would certainly have saved a lot of typing....I will try it

pungentSapling is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump




All times are GMT -8. The time now is 07:48 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World