zelarra821
Registered User.
- Local time
- Today, 07:00
- Joined
- Jan 14, 2019
- Messages
- 834
can you post an updated version. The last version fails again when I try to scroll. The query is missing again.
I will wait until you get this working as you like.
3. One thing that would have made this much simpler and more efficient.
You save keys for formato, autor, genero, subgenero, ...
You should be doing the filters on those keys and not the text. The forms rowsource should have both. Display the text and filter on the key. Unfortunately you named all your keys ID. So in the query you need to alias them
select testados.ID as Estados_ID, testados.Estados,... tFormatoID as FormatoID
The comboxes should return ID. You will never have to worry about accent. Only need this for the FAYT and textbox.
However I think you changed it to cmbofilter which you could try frm.cmboFilter
Again this may be centralizing too much. Is the next form going to have cmboFilter
You should be able to do the same in the filter requery
However whenever you do activecontrol, activeform ... It is not very precise. This all depends on focus, so I try to avoid this when I can. Keeping it in the form and using ME ensures you return the correct thing. Again in my opinion you are better off not centralizing it. This code is pretty unique to a certain type of form.
Sorry for not uploading a corrected version. I told you I would and in the end I forgot. If I have taken so long to answer you, it is because I have been since you wrote to me at noon, Spanish time, applying what you have taught me, and I have just finished now.
I have changed the IDs to as you have told me.
The database works as I want, except for 3 problems:
1. I had this error before and it was solved with a FName.ActiveControl.Requery, but it fails again: you start the form, go to the IDEstados drop-down, choose Comprar, and it shows you the Borrado records. No matter how much I think about it, I can't find the solution.
2. In the FBuscadorDeLibros form, in CmdFiltrarPorNumero_Click, it doesn't work well this line:
Code:
If Not Screen.PreviousControl.Name = "Lines" Or Screen.PreviousControl.Name = "Pages" Then Exit Sub
It does not open the message when I am in the Pages field. If I reverse the order in the If, the opposite happens to me, it does not open the message when I am in the Lines field.
3. This is more accessory, but hey, since we are, I wonder if I had a solution. When changing the name of the IDs, and therefore the dependent column in the rowsources of the combos, before I established a help text using, for example, @; "Status" in the Format. Of course, this happens by having the third column as a dependent. If it were the first, it would come out. Can that be corrected in any way?
Also, I have applied FAYT and filters on two other forms (FAutores and FSubgeneros), with their own queries to filter the combos and their own functions, so as not to complicate the code. I don't know if it has gone from one extreme to the other. In FSubgeneros everything works fine, except what I told you above in point 1.
Thank you very much for the lesson. I think I have yet to learn when is better and when not. I don't know where I could have created more difficulty without realizing it.Centralize if it is reuseable and generic, but do not if you end up creating more difficulty.
Thank you so much.