Suggetions about my DB

spa856

New member
Local time
Today, 06:42
Joined
Apr 21, 2023
Messages
26
Hello

I would like to ask some suggestions about my DB.
  1. In the Clienti when I click on the unbound search it shows me an error.
    I don't understand why. I set the same VBA code of the others form.
For your information, in the home page form, 3 buttons (Recuperatori, Report and Storico) are in work in progress (not linked)
I would like to have comments about the layout and some changes that could be made to make it better.
Thank you
 

Attachments

Last edited:
Me.Anagrafica.Form.Requery
 
on change.
Thank you
Other suggestions about the layout?
 
Last edited:
1. Anytime I see a table with fields with incremented names, I know the table is not normalized (ex Child1, Child2, Child3. .... Child 10). So I am pretty suspect on T_Istanza. Pretty sure that needs a related table for ERR.
2. The relations appear correct and the naming convention appears good except for the ERR space Number. Never put any spaces in names. You avoided that everywhere else with under scores.
3. You were consistent in your naming with Primary keys ID_Name and the FKs which is good. I personally like to name my FKs differently with an additional suffix. ID_PV_FK. That way you can quickly look at a table and know which one is the PK and which is/are the FK.

4. If a control is ever referenced or used in code then give it a meaningful names. Instead of label37, "lblPunti_Vendita" or "lblRicerca"

Code:
Private Sub Label37_Click()
DoCmd.OpenForm ("F_RICERCA")
DoCmd.Close acForm, "F_HOME_PAGE", acSavePrompt
End Sub

5. Also the acSavePrompt and other save enumerations do nothing unless the form is opened in design mode? No need to use any save enumerations unless you open the form in design mode which you should never do anyways.

6. I personally dislike your form aesthetics, but others might like it. I find them hard to read and the color scheme unpleasant. But that is just my opinion.

I will not waste my time looking any further since the database does not compile. It is full of bad lines of code and objects that do not exist. Compile the code and fix all the errors first.



Istanza.jpg
 
Sorry @MajP.
I have a problem on the DB, before it worked.
I need to select a specific record on F_RICERCA and then click on the icon open a form F_PUNTO VENDITA where I can see all the information of the Punto Vendita.
It doesn't work, it open always the same record even if I select another one.

Private Sub CmdViewPV_Click()
DoCmd.OpenForm "F_PUNTO_VENDITA"
Forms![F_PUNTO_VENDITA].Filter = "[ID_PV] = " & Me.ID_PV
Forms![F_PUNTO_VENDITA].FilterOn = True
End Sub
I tried also
DoCmd.OpenForm "F_PUNTO_VENDITA", , , "ID_PV=" & Me.ID_PV
 
Last edited:
This line by itself works and can be tested
DoCmd.OpenForm "F_PUNTO_VENDITA", , , "ID_PV=" & Me.ID_P
I typed this in the immediate windo
DoCmd.OpenForm "F_PUNTO_VENDITA", , , "ID_PV="& 24
and it opens correctly.
If you provide a valid ID_PV number this works

I would test this to make sure you are pulling the ID_PV from the form make sure
dim id as long
id = nz(me.ID_PV,0)
Msgbox "ID selected is " & ID
DoCmd.OpenForm "F_PUNTO_VENDITA", , , "ID_PV=" & ID

Is there any code in the load event of F_Punto_Vendita?
 
At open only the code for the side of screen.
On current me.allowedit false
 
if you try my test it will confirm if you are passing a valide ID_PV

Which form and which control calls this code?
 
The form F_RICERCA open the form F_PUNTO_VENDITA for the selected record on the F_RICERCA. The ID_PV are Always set, i don't understand why It doesn't work
 
You simply need to replace the image with a command button. An image control cannot take focus so the record does not move to the selected line in the current form. You can test this with yours. Click first into a record then select. It will go to the selected record.. If you change to a command button it can take the focus and the record will change to the selected line.
 
This will help to demonstrate the issue. Watch the record selector as you click the image, then click the command button. Both have the same code.
 

Attachments

Users who are viewing this thread

Back
Top Bottom