Relationship form/subform

spa856

New member
Local time
Today, 11:08
Joined
Apr 21, 2023
Messages
26
Hello All,

I have created a DB with 4 tables related in this way
1682063119738.png


I am trying to create a form for create the t_punto_vendita's information.
My question is: T_PUNTO_VENDITA have two input tables T_ BRAND and T_COMUNE and I would like to create a form where the user via two combobox can select in the first one the Brand and in the second one the Comune and then T_PUNTO_VENDITA reflect the key of the two tables in the proper fields and the user can proceed to create the new record in T_PUNTO_VENDITA.
Is it possibile and how?
thank you
 
just add two combobox, that will save the ID_BRAND from T_BRAND.

rowsouce:
select ID_BRAND, CLIENTE from T_BRAND;
bound column:
1
column widths:
0;1
list width:
1


the second combo will save the ID_COMUNE fom T_COMUNE

rowsurce:
select ID_COMUNE, PROVINCIA from T_COMUNE;
bound column:
1
column widths:
0;1
list width:
1
 
Thank you for your prompt reply.
In addition,the recordsource of the form will be T_PUNTO_VENDITA, right?
 
In addition,the recordsource of the form will be T_PUNTO_VENDITA, right?
yes, ofcourse.

the two combobox are Bound to ID_BRAND and ID_COMUNE (of T_PUNTO_VENDITA table) respectively.
 
ok it works.
thank you
 
Last edited:
what is the relation you showed, for the form?
if for the form, you only need T_PUNTO_VENTITA, not the 2 other tables.
 
No it was related to another query.
I solved, i was wrong the join type
 
Last question, I hope.
I set the Home Page form as modal Yes and Pop Up Yes and set the form as default page on opening the application.
Can I hide the All Access Objects frame and the option access Db above? (File, Home etc)
1682069464140.png
 
add this code in a Module:
Code:
Declare PtrSafe Function MoveWindow Lib "user32" _
            (ByVal hwnd As LongPtr, _
            ByVal x As Long, _
            ByVal y As Long, _
            ByVal nWidth As Long, _
            ByVal nHeight As Long, ByVal bRepaint As Long) As Long

add code to your Form's Open event:
Code:
Private Sub Form_Open(Cancel As Integer)
    MoveWindow Application.hWndAccessApp, 1024, 2024, 0, 0, 0
End Sub

all your forms must be Pop-up.
 
Here's a sample that shows how a many-many relationship works. It shows forms that display the relationship from the perspective of either side of the relationship. In one direction, it uses a subform but from the other direction, it uses a popup. Both methods are valid but one usually makes more sense for your purpose than the other so use whichever makes sense in context.

 

Users who are viewing this thread

Back
Top Bottom