A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Displaying a record in a subform.



 
 
Thread Tools Display Modes
  #1  
Old November 5th, 2006, 03:05 PM posted to microsoft.public.access.forms
bvdahl
external usenet poster
 
Posts: 23
Default 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  
Old November 5th, 2006, 03:09 PM posted to microsoft.public.access.forms
Rick Brandt
external usenet poster
 
Posts: 4,354
Default 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  
Old November 5th, 2006, 03:22 PM posted to microsoft.public.access.forms
bvdahl
external usenet poster
 
Posts: 23
Default 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  
Old November 5th, 2006, 03:35 PM posted to microsoft.public.access.forms
Rick Brandt
external usenet poster
 
Posts: 4,354
Default 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  
Old November 5th, 2006, 03:35 PM posted to microsoft.public.access.forms
Rick Brandt
external usenet poster
 
Posts: 4,354
Default 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  
Old November 5th, 2006, 03:53 PM posted to microsoft.public.access.forms
bvdahl
external usenet poster
 
Posts: 23
Default 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  
Old November 5th, 2006, 03:58 PM posted to microsoft.public.access.forms
Rick Brandt
external usenet poster
 
Posts: 4,354
Default 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  
Old November 5th, 2006, 04:16 PM posted to microsoft.public.access.forms
bvdahl
external usenet poster
 
Posts: 23
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:51 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.