Sabtu, 13 Mei 2017

[MS_AccessPros] Populating a combo from other combo.

 

I have three combos boxes, which should populate the next automatiacally. The first one is cboCabinet:


Private Sub cboCabinet_AfterUpdate()
Dim sFolderLoadSource As String
   
    sFolderLoadSource = "SELECT [tblFolders].[FolderID], [tblFolders].[CabinetID], [tblFolders].[FolderName] " & _
                        "FROM tblFolders " & _
                        "WHERE [CabinetID] = " & Me.cboCabinet.Value
    Me.cboFolders.RowSource = sFolderLoadSource
    Me.cboFolders.Requery


    Me.sfrmIndexes.Form.Requery
End Sub


This Works to populate the second combo called cboFolders.


Private Sub cboFolders_AfterUpdate()
Dim sFolderSource As String
   
    sFolderSource = "SELECT [tblSubFolders].[SUbFolderID], [tblSubFolder].[FolderID], [tblSubFolder].[SubFolderName] " & _
                        "FROM tblSubFolders " & _
                        "WHERE [FolderID] = " & Me.cboFolders.Value
    Me.cboSubFolders.RowSource = sFolderSource
    If sFolderSource = "" Then
      Me.cboSubFolders.Value = "No Sub Folders"
    Else
      Me.cboSubFolders.Requery
    End If
   


End Sub


My issues when it tries to populate the 3rd combo called cboSubFolders, there might be cases where there is no records in the subfolder table for a given combination of the first two combos. I am trying to set the value of cboSubFolders to No SubFolders in case of this combination. But it is not working. Any ideas?


Signed,


Art Lorenzini

Sioux Falls, SD

__._,_.___

Posted by: dbalorenzini@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar