View Single Post
  #3  
Old October 27th, 2009, 04:53 PM posted to microsoft.public.access.forms
Marc T
external usenet poster
 
Posts: 35
Default Cascading Combo Boxes - How to deal with one being empty?

Thanks for the reply!

I have managed to almost solve with the following:

Private Sub Combo0_GotFocus()

If Combo6.Value "" Then
Combo0.RowSource = "SELECT DISTINCT tblAllDocsAppend.DOC_NO FROM
tblAllDocsAppend WHERE
((MID(tblAllDocsAppend.DOC_NO,7,4)=Forms!frmMainCo mboBoxTest!Combo6)) ORDER
BY [DOC_NO]; "
Else
Combo0.RowSource = "SELECT DISTINCT tblAllDocsAppend.DOC_NO FROM
tblAllDocsAppend ORDER BY [DOC_NO]; "
End If

End Sub

The only remaining stickler is how to allow "all" to be selected from the
Supplier combo box seeing as the rowsource is a query. Any ideas?

Cheers,
Marc

"Mr. B" wrote:

This sounds like one of those situations where you many need to dynamically
build the sql statement using VBA code that populates the Doc Number combo
box.

Here is a link that might help:
http://msdn.microsoft.com/en-us/library/dd627355.aspx

-----
HTH
Mr. B
http://www.askdoctoraccess.com/
Doctor Access Downloads Page:
http://www.askdoctoraccess.com/DownloadPage.htm


"Marc T" wrote:

Hi again,

I have a set of three cascading combo boxes for the following;

Supplier Code, Doc Number, Revision

all is working great, but what I'd like to do is allow the Doc Number combo
to show data for all suppliers if the Supplier Code combo is left empty. At
the moment it shows as a blank if no supplier is selected.

Any help would be great!
Marc