If Unbound Combo is Null it Shows All Records

D

dan.cawthorne

So Then I Have a Combo List Box thats have a selectable values, to
select from, unbound of course,

I Select the required value then i click on a button which opens
another form which shows all related records that match the value in
that combo list.

How do i got the Query that looks at the combo list for the value to
show all records in the query is the unbound combo box is left null
"Blank"

Help Is Needed

Dan
 
D

Douglas J. Steele

Presumably you've got something like

Forms![NameOfForm]![NameOfComboBox]

as the criteria under a specific field in your query grid. Change that
criteria to

Forms![NameOfForm]![NameOfComboBox] OR (Forms![NameOfForm]![NameOfComboBox]
IS NULL)
 
S

Stuart McCall

So Then I Have a Combo List Box thats have a selectable values, to
select from, unbound of course,

I Select the required value then i click on a button which opens
another form which shows all related records that match the value in
that combo list.

How do i got the Query that looks at the combo list for the value to
show all records in the query is the unbound combo box is left null
"Blank"

Help Is Needed

Dan

Well presumably you're opening the form with a where clause that utilizes
the combo's value. If so, then if the combo is empty, don't specify a where
clause. Something like:

If Len(Me.MyCombo & "") > 0 Then
DoCmd.OpenForm "MyForm", , , "ID=" & Me.MyCombo
Else
DoCmd.OpenForm "MyForm"
End If
 
D

dan.cawthorne

Presumably you've got something like

Forms![NameOfForm]![NameOfComboBox]

as the criteria under a specific field in your query grid. Change that
criteria to

Forms![NameOfForm]![NameOfComboBox] OR (Forms![NameOfForm]![NameOfComboBox]
IS NULL)

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)




So Then I Have a Combo List Box thats have a selectable values, to
select from, unbound of course,
I Select the required value then i click on a button which opens
another form which shows all related records that match the value in
that combo list.
How do i got the Query that looks at the combo list for the value to
show all records in the query is the unbound combo box is left null
"Blank"
Help Is Needed
Dan- Hide quoted text -

- Show quoted text -

Thanks Doug Just What i wanted.

Ps Can i Make an Unbound text box required? which a message box?
 
D

dan.cawthorne

Not sure I understand the question.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)






- Show quoted text -

Not to worry mate, Ive sorted the problem,

all i did was on the button on the form,

is have something like

Private Sub ClientSearchCmd_Click()
If IsNull(Me.ClientLookupCmbo) Then
MsgBox "Please Select a Company First", vbOKOnly
Else
DoCmd.OpenForm "frm_ViewProjectsByClients"
DoCmd.Close acForm, Me.Name
End If
End Sub

But What i need to do is add to this code is txtafterdate and
beforedate is there left blank just not the ClientlookupCmbo
 

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

Top