If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Displaying a record in a subform.
Hello,
This is probably really easy, but I am stuck big time anyway. I have a main form (search) and a sub form (details). In the main form, there is a list box displaying a filtered selections of clients. In the sub form, the user can edit the address and contact details of clients. What I would like to do, is when the user clicks a client in the main form's list box, that clients record is displayed in the sub form, ready to be edited. I have struggled for many hours now, and I would really appreaciate som help. thx Baard |
#2
|
|||
|
|||
Displaying a record in a subform.
bvdahl wrote:
Hello, This is probably really easy, but I am stuck big time anyway. I have a main form (search) and a sub form (details). In the main form, there is a list box displaying a filtered selections of clients. In the sub form, the user can edit the address and contact details of clients. What I would like to do, is when the user clicks a client in the main form's list box, that clients record is displayed in the sub form, ready to be edited. I have struggled for many hours now, and I would really appreaciate som help. thx Baard Set the Masterlink property of the subform control to the name of the ListBox and the Childlink property to the matching field in the subform. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#3
|
|||
|
|||
Displaying a record in a subform.
Hello,
Thank you for your very quick reply I probably should have pointed out that the main form is unboundIt is really just a textbox that starts a SQL statement that populates the listbox. The subform is linked to the client database. When I try to do something with the 'Link Child Fields' and 'Link Master Fields', I get an error message saying 'Can't build a link between unbound forms'. I've tried my way with the little VBA that I know, but so far with little success. Baard "Rick Brandt" wrote: bvdahl wrote: Hello, This is probably really easy, but I am stuck big time anyway. I have a main form (search) and a sub form (details). In the main form, there is a list box displaying a filtered selections of clients. In the sub form, the user can edit the address and contact details of clients. What I would like to do, is when the user clicks a client in the main form's list box, that clients record is displayed in the sub form, ready to be edited. I have struggled for many hours now, and I would really appreaciate som help. thx Baard Set the Masterlink property of the subform control to the name of the ListBox and the Childlink property to the matching field in the subform. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#4
|
|||
|
|||
Displaying a record in a subform.
bvdahl wrote:
Hello, Thank you for your very quick reply I probably should have pointed out that the main form is unboundIt is really just a textbox that starts a SQL statement that populates the listbox. The subform is linked to the client database. When I try to do something with the 'Link Child Fields' and 'Link Master Fields', I get an error message saying 'Can't build a link between unbound forms'. I've tried my way with the little VBA that I know, but so far with little success. It is true that you can't use the builder form for setting the MasterLink and ChildLink properties when either form is unbound. However; there is nothing to prevent you from manually making the appropriate entries. Just click in the property box and type the entries from the keyboard. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#5
|
|||
|
|||
Displaying a record in a subform.
bvdahl wrote:
Hello, Thank you for your very quick reply I probably should have pointed out that the main form is unboundIt is really just a textbox that starts a SQL statement that populates the listbox. The subform is linked to the client database. When I try to do something with the 'Link Child Fields' and 'Link Master Fields', I get an error message saying 'Can't build a link between unbound forms'. I've tried my way with the little VBA that I know, but so far with little success. It is true that you can't use the builder form for setting the MasterLink and ChildLink properties when either form is unbound. However; there is nothing to prevent you from manually making the appropriate entries. Just click in the property box and type the entries from the keyboard. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#6
|
|||
|
|||
Displaying a record in a subform.
ok, I see.
Could I bother you to tell me the syntax? I tried Forms![mainform]![listboxname] in master and customer_id in the child, but that didn't work. Baard "Rick Brandt" wrote: bvdahl wrote: Hello, Thank you for your very quick reply I probably should have pointed out that the main form is unboundIt is really just a textbox that starts a SQL statement that populates the listbox. The subform is linked to the client database. When I try to do something with the 'Link Child Fields' and 'Link Master Fields', I get an error message saying 'Can't build a link between unbound forms'. I've tried my way with the little VBA that I know, but so far with little success. It is true that you can't use the builder form for setting the MasterLink and ChildLink properties when either form is unbound. However; there is nothing to prevent you from manually making the appropriate entries. Just click in the property box and type the entries from the keyboard. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#7
|
|||
|
|||
Displaying a record in a subform.
bvdahl wrote:
ok, I see. Could I bother you to tell me the syntax? I tried Forms![mainform]![listboxname] in master and customer_id in the child, but that didn't work. In MasterLink you would just put the name of the ListBox listboxname In ChildLink you would put the name of the *field* in the subform that should match the value chosen in the ListBox. That's an important distinction. The MasterLink can be a field name or a control name or in fact any legal expression. The ChildLink must be a field name or an expression that references a field name. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#8
|
|||
|
|||
Displaying a record in a subform.
Great, that worked.
Thanks a lot Baard "Rick Brandt" wrote: bvdahl wrote: ok, I see. Could I bother you to tell me the syntax? I tried Forms![mainform]![listboxname] in master and customer_id in the child, but that didn't work. In MasterLink you would just put the name of the ListBox listboxname In ChildLink you would put the name of the *field* in the subform that should match the value chosen in the ListBox. That's an important distinction. The MasterLink can be a field name or a control name or in fact any legal expression. The ChildLink must be a field name or an expression that references a field name. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
Thread Tools | |
Display Modes | |
|
|