Solved Multiple search engine with dropdowns (2 Viewers)

zelarra821

Registered User.
Local time
Today, 10:48
Joined
Jan 14, 2019
Messages
803
No that cannot be done, with or without any filters. There is no you can bind a multi select listbox to a control. Your locations have to be stored in a junction table unless you use a multivalue field. That is two bad ideas.

I would concatenate the value using a concatenate function in the query
So you display. location1; Location2; Location 4
If you want to add or delete locations than you do that with a pop up form.
You also have the calculated field with only IDs, but not shown
1;2;4

Then you can code a filter. It can be done, it will be complicated.
And understanding what I'm looking for, is there a simple way to do it? You have proposed a complicated
 

zelarra821

Registered User.
Local time
Today, 10:48
Joined
Jan 14, 2019
Messages
803
Because the only thing I can think of is repeating songs, that is, that there are as many records of a song as there are times it appears repeated in several albums
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:48
Joined
May 21, 2018
Messages
8,463
Try this in the read files.
Code:
Private Sub cmdRead_Click()
  ClearTree
  SpanAndLog
  LoadFileDirectory Me.cmboDefault
  mcTree.ExpandToLevel 1, True
  mcTree.Refresh
  mcTreeSummation.ExpandToLevel 1, True
  mcTreeSummation.Refresh
End Sub
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:48
Joined
May 21, 2018
Messages
8,463
And understanding what I'm looking for, is there a simple way to do it? You have proposed a complicated
No there is no easy way to do it. I have never even seen anyone use a listbox in a continuous form because it does not make any sense because you are unlikely to even see the selection unless you have a large listbox. Fore sure I have never seen a multiselect listbox in a continuous form. If I was to do it I would show these values concatenated and have a popup to add or delete. If you think about it this would be a useless presentation. If they had selections 6,7,8 you would not see any selections.
 

zelarra821

Registered User.
Local time
Today, 10:48
Joined
Jan 14, 2019
Messages
803
Try this in the read files.
Code:
Private Sub cmdRead_Click()
  ClearTree
  SpanAndLog
  LoadFileDirectory Me.cmboDefault
  mcTree.ExpandToLevel 1, True
  mcTree.Refresh
  mcTreeSummation.ExpandToLevel 1, True
  mcTreeSummation.Refresh
End Sub
Keep changing the value in the table for me.
 

zelarra821

Registered User.
Local time
Today, 10:48
Joined
Jan 14, 2019
Messages
803
No there is no easy way to do it. I have never even seen anyone use a listbox in a continuous form because it does not make any sense because you are unlikely to even see the selection unless you have a large listbox. Fore sure I have never seen a multiselect listbox in a continuous form. If I was to do it I would show these values concatenated and have a popup to add or delete. If you think about it this would be a useless presentation. If they had selections 6,7,8 you would not see any selections.

I agree. Thanks so much for the explanation. In this case, what I will do is add all the songs, even if they are on different discs.

What I told you I had in mind for another database, but I have looked for another alternative, which I think may be simpler. It would have a list box to choose the options you want to print. On this page comes an example (number 84) of how to do it: https://sites.google.com/site/jerrmex/descargas.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:48
Joined
May 21, 2018
Messages
8,463
It would not be hard to concatenate the solution and show in a textbox, but you would not be able to edit them from that location.

You could display

SongADisc 1
Dis 2
SongBDisc 3
SongCDisc1
Disc 3

Where the location field is a concatenated field, displayed in a textbox. You cannot shrink or grow so all are the same size.
 

zelarra821

Registered User.
Local time
Today, 10:48
Joined
Jan 14, 2019
Messages
803
It would not be hard to concatenate the solution and show in a textbox, but you would not be able to edit them from that location.

You could display

SongADisc 1
Dis 2
SongBDisc 3
SongCDisc1
Disc 3

Where the location field is a concatenated field, displayed in a textbox. You cannot shrink or grow so all are the same size.

I understand that you say to concatenate the locations, but I don't know how you intend to do it. Also, I also don't understand that I couldn't edit it and they would all be the same size.
 

zelarra821

Registered User.
Local time
Today, 10:48
Joined
Jan 14, 2019
Messages
803
Try this in the read files.
Code:
Private Sub cmdRead_Click()
  ClearTree
  SpanAndLog
  LoadFileDirectory Me.cmboDefault
  mcTree.ExpandToLevel 1, True
  mcTree.Refresh
  mcTreeSummation.ExpandToLevel 1, True
  mcTreeSummation.Refresh
End Sub

I've already caught the bug, and it was mine. Above the form you showed the route, but it took only the one of the first route, and what I did was "make it dynamic", using this line. Of course, I did not realize that it is referenced to the table, and hence I changed it.

Code:
  Me.TxtDefaultFolderPath = Me.cmboDefault.Column(2)

Thanks a lot.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:48
Joined
May 21, 2018
Messages
8,463
I understand that you say to concatenate the locations, but I don't know how you intend to do it. Also, I also don't understand that I couldn't edit it and they would all be the same size
I will do a demo when I get some time. I am tearing out a bathroom today.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:48
Joined
May 21, 2018
Messages
8,463
See demo.
 

Attachments

  • Nuevo _MajP.accdb
    1.4 MB · Views: 135

zelarra821

Registered User.
Local time
Today, 10:48
Joined
Jan 14, 2019
Messages
803
Hi. I like the idea.

We are going to improve it. I have set FAYT to search for a text string using the SearchFor text box, and also to search by location using the cmbLocation dropdown. To get it to work, I had to use Like. For this there is no problem, because it works.

Now, in the form where I enter the locations, I want to replace the form with datasheet view, with a list box. I have managed to add the locations that I mark (whether I mark one, or if I mark several). However, there are three problems that I cannot solve:

1. When you open the form for choosing locations, the locations that are already assigned to the song should be highlighted. To do this, I think, you have to do the reverse step: de-chain. And through a for next enter the selected items.

2. Another thing is that, once those associated with the song appear selected, if I deselect one, I should remove it, both from the FSongs form field and from the j_tblSongsLocations table.

3. Do not add the locations at the end, but replace the existing ones with the selected ones. For example, I have three selected, and I add a fourth. What should appear are four, not 3 + 4 as it happens now.


Thank you very much for the demo. It's super good.
 

Attachments

  • Nuevo _MajP - copia.accdb
    1.9 MB · Views: 107

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:48
Joined
May 21, 2018
Messages
8,463
See demo
 

Attachments

  • SelectUnselectMultiSelect.accdb
    848 KB · Views: 132

zelarra821

Registered User.
Local time
Today, 10:48
Joined
Jan 14, 2019
Messages
803
Yes, perfect. Now I put together the three databases into one, I hope not to mess it up.

1. Another thing I've been seeing regarding the tree. There is the possibility to change the design of the tree, by touching these two parameters:

Code:
.Indentation = 15 * mcPtPixel 'To 25
.NodeHeight = 20 * mcPtPixel 'To 25

However, I change them in the InitializeTree and InitializeSummationTree procedures, and it only changes the first tree, not the summation. Look:

ScreenShot001.jpg ScreenShot002.jpg

2. In addition, in the attached database there is the possibility of changing the icon to expand. Instead of a square put a triangle. I am trying to change it but I am not able to. I leave you a video:

 

Attachments

  • treeviewaccess.zip
    328.1 KB · Views: 114

zelarra821

Registered User.
Local time
Today, 10:48
Joined
Jan 14, 2019
Messages
803
I have already managed to put the symbols I wanted.

You have to put this in the header of the form where the tree is:

Code:
Private mfrImages As MSForms.Frame

In the event when loading, you have to load the images:

Code:
     Set mfrImages = Me.subTreeView.Form.Controls ("frImages"). Object

And then in both InitializeTree and InitializeSummationTree, under

Code:
         .ShowExpanders = True

add this

Code:
         Call .ExpanderImage (mfrImages.Controls ("Win7Minus"). Picture, _
                                 mfrImages.Controls ("Win7Plus2"). Picture)

And with that it would change the icons.

Now, what I am not able to do is update the Summation tab. No matter how much I give the code, I don't see where the fault is, so if you do me a favor, you know how you did it, tell me where I would have to touch so that it applies the same changes in that tab. I leave you the database with all the changes.

Thank you.
 

Attachments

  • VideoToDo_MajP1 - copia.accdb
    2.8 MB · Views: 101

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:48
Joined
May 21, 2018
Messages
8,463
Sorry that was my fault. I have two methods that allow you to format each tree. The problem was in the second method for the summation, I copied from the first method. I did not change mcTree to mcTreeSummation after copying. The second method was just reformatting the first tree.
Code:
Private Sub InitializeSummationTree()
'-------------------------------------------------------------------------
' Procedure : Initialize
' Company   : JKP Application Development Services (c)
' Author    : Jan Karel Pieterse (www.jkp-ads.com)
' Created   : 15-01-2013
' Purpose   : Initializes the userform,
'             adds the VBA treeview to the container frame on the userform
'             and populates the treeview.
'-------------------------------------------------------------------------

    On Error GoTo errH

    ' create a new clsTreeview returned with the TreeControl container attached
    ' (a new treeclass cleans out previous properties, though could reuse an old treeclass)
    Set mcTreeSummation = Me.subTreeViewSummations.Form.pTreeview
    
    With mcTreeSummation
        Call .NodesClear ' if reusing an exisiting treeclass
        .AppName = "Video File Directory"
        'Set some characteristics of the root of the tree,
        .CheckBoxes() = False
        .LabelEdit(bAutoSort:=True) = 1  'default 0, can be edited (like LabelEditConstants tvwAutomatic/tvwManual)
        ' new in v022, EnableLabelEdit added as alternative to LabelEdit
        .EnableLabelEdit(bAutoSort:=True) = False
        .FullWidth = True
        'Need to find out what this conversion is the constant is .75
        .Indentation = 25 * mcPtPixel '15
        .NodeHeight = 25 * mcPtPixel '20
        .ShowLines = True
        .ShowExpanders = True
        Call .ExpanderImage(mfrImages.Controls("Win7Minus").Picture, _
                                mfrImages.Controls("Win7Plus2").Picture)
    End With
    Exit Sub
errH:
    #If debugMode = 1 Then
        Debug.Print Err.Source, Err.Description
        Stop
        Resume
    #End If

    Debug.Print Err.Source, Err.Description

    If Not mcTreeSummation Is Nothing Then
        mcTreeSummation.NodesClear
    End If
End Sub

These needed to get change to mcTreeSummation from mcTree
Set mcTreeSummation = Me.subTreeViewSummations.Form.pTreeview
With mcTreeSummation
 

zelarra821

Registered User.
Local time
Today, 10:48
Joined
Jan 14, 2019
Messages
803
I've already seen where the error was:

With mcTreeSummation

I'm going to join the three databases and translate them. Thanks a lot.
 

zelarra821

Registered User.
Local time
Today, 10:48
Joined
Jan 14, 2019
Messages
803
I'm trying to put a default value in the dropdown Estado, and it won't let me. It does not matter if you put it in the properties of the drop-down or activate Me.FilterOn when starting the form.
 

Attachments

  • Database5MajP.accdb
    1 MB · Views: 110

Users who are viewing this thread

Top Bottom