Another Iceacream.mdb question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a question on a database that I found on the web, Icecream.mdb and
also in a book . My question is about the criteria form that they have.

On one of the comboboxes the rowsource is from a union query as follows
SELECT tblCompany.CompanyID, tblCompany.CompanyName
FROM tblCompany
union select -1,'<All Companies>' from tblCompany ORDER BY
tblCompany.CompanyName;

How will I in the module code it so that when I select <All Companies> am
able to get a result based on all

If chkCompanyID Then
sWHERE = sWHERE & " AND s.fkCompanyID = " & cboCompanyID
End If
 
Apply the WHERE only if the combo is not -1:

If (Me.chkCompanyID.Value) AND (Nz(Me.cboCompanyID,-1) <> -1) Then
sWHERE = sWHERE & " AND s.fkCompanyID = " & cboCompanyID
End If
 

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


Back
Top