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  

SubForm



 
 
Thread Tools Display Modes
  #1  
Old August 18th, 2005, 06:30 PM
Lisheen
external usenet poster
 
Posts: n/a
Default SubForm

HI All,

I am hoping someone can help, I have two problems with a subform. I need to
have a subform which is connected to the parent form by a field for example
"code" field however I do not want the subform to automatically display the
previous record for this "code" I want it do display a new record with the
code field on the subform populated with the value entered in the parent code
field.


I also need to have set the value of a field on the subform to equal that
on the parent form. For example if the item number on the parent field is
entered as C118, I need the field on the subform to automatically equal this
value. Is this possible as so far everything I have tried has failed.

Both problems are more or less the same but any help or guidance would be
gratefully appreciated.
  #2  
Old August 18th, 2005, 07:54 PM
BruceM
external usenet poster
 
Posts: n/a
Default

A little more punctuation might have helped, but I think I get the idea.
Tables contain fields. Forms contain controls that are bound to the table
fields. You need to establish the proper relationship between the
underlying tables. When that is done the linked field will not need to be
populated through the subform, but will contain the same value as the
related field in the main table.
To see only the new record (and not be able to see previous records) set the
form's (or subform's) data entry property to Yes. This setting is located
in the form's Property Sheet (View Properties). To open to a new record,
add the following to the form's Open event:
Me.Recordset.AddNew
I think DoCmd.GoToRecord , , acNewRec does the same thing. Not sure what
the difference is.
As for setting a field in the subform's record source to be the same as a
field in the main form's record source, there is probably no need. If you
want to see the value of a field copied to the subform you could use code to
refer to the control, but there are a lot of possibilities, and you have
provided few details.
More information is needed. It would help, too, if you describe a bit more
about the database's purpose.

"Lisheen" wrote in message
...
HI All,

I am hoping someone can help, I have two problems with a subform. I need
to
have a subform which is connected to the parent form by a field for
example
"code" field however I do not want the subform to automatically display
the
previous record for this "code" I want it do display a new record with the
code field on the subform populated with the value entered in the parent
code
field.


I also need to have set the value of a field on the subform to equal that
on the parent form. For example if the item number on the parent field is
entered as C118, I need the field on the subform to automatically equal
this
value. Is this possible as so far everything I have tried has failed.

Both problems are more or less the same but any help or guidance would be
gratefully appreciated.



  #3  
Old August 19th, 2005, 10:52 AM
Lisheen
external usenet poster
 
Posts: n/a
Default

Thanks for replying Bruce, the form is used to keep a record work carried out
on equipment, the main form would open to allow the user to add details of
the work carried out, the sub form is used to add details of the equipment
used to carry out the work. Therefore each record for both the subform and
the main form must be unique and not over written.

The main form is linked to the work table and the sub form is linked to the
equipment used table. They have a common field called equipment number, as
I will need to be able to query later to see what equipment had work carried
out on it by any given tool / equipment.

Therefore when the main form and sub form opens in add only mode, the user
must enter the equipment number on the main form in the equipment number text
box linked to the equipment number field in of the underlying table after
completing the main form. He then must complete the equipment number in the
sub form.

To avoid this how could I get the equipment number to appear automatically
in the sub form when the user enters the number in the main form.

Rgds

Nora.

"BruceM" wrote:

A little more punctuation might have helped, but I think I get the idea.
Tables contain fields. Forms contain controls that are bound to the table
fields. You need to establish the proper relationship between the
underlying tables. When that is done the linked field will not need to be
populated through the subform, but will contain the same value as the
related field in the main table.
To see only the new record (and not be able to see previous records) set the
form's (or subform's) data entry property to Yes. This setting is located
in the form's Property Sheet (View Properties). To open to a new record,
add the following to the form's Open event:
Me.Recordset.AddNew
I think DoCmd.GoToRecord , , acNewRec does the same thing. Not sure what
the difference is.
As for setting a field in the subform's record source to be the same as a
field in the main form's record source, there is probably no need. If you
want to see the value of a field copied to the subform you could use code to
refer to the control, but there are a lot of possibilities, and you have
provided few details.
More information is needed. It would help, too, if you describe a bit more
about the database's purpose.

"Lisheen" wrote in message
...
HI All,

I am hoping someone can help, I have two problems with a subform. I need
to
have a subform which is connected to the parent form by a field for
example
"code" field however I do not want the subform to automatically display
the
previous record for this "code" I want it do display a new record with the
code field on the subform populated with the value entered in the parent
code
field.


I also need to have set the value of a field on the subform to equal that
on the parent form. For example if the item number on the parent field is
entered as C118, I need the field on the subform to automatically equal
this
value. Is this possible as so far everything I have tried has failed.

Both problems are more or less the same but any help or guidance would be
gratefully appreciated.




  #4  
Old August 19th, 2005, 12:55 PM
BruceM
external usenet poster
 
Posts: n/a
Default

Are you saying that there is a one-to-one relationship between the tables?
Further, are you saying that one piece of equipment (and one piece only) is
used to perform the work on a piece of equipment? Can there be more than
one record in the subform's record source for each record in the main form's
record source. What equipment details are you talking about? Is there an
equipment table, or are you creating a new record each time you use a
particular piece of equipment?
Have you established relationships between the tables? If so, what is it?
Please post the relevant fields from the two tables. It would help, too, if
you describe a bit more fully what you need to do. For instance, the
meaning of "details of the equipment used to carry out the work" is not
clear. What sorts of details?
In general, if there is one (and only one) record in the subform record
source for each record in the main form record source, there may be no need
for having two tables.

"Lisheen" wrote in message
...
Thanks for replying Bruce, the form is used to keep a record work carried
out
on equipment, the main form would open to allow the user to add details of
the work carried out, the sub form is used to add details of the equipment
used to carry out the work. Therefore each record for both the subform
and
the main form must be unique and not over written.

The main form is linked to the work table and the sub form is linked to
the
equipment used table. They have a common field called equipment number,
as
I will need to be able to query later to see what equipment had work
carried
out on it by any given tool / equipment.

Therefore when the main form and sub form opens in add only mode, the user
must enter the equipment number on the main form in the equipment number
text
box linked to the equipment number field in of the underlying table after
completing the main form. He then must complete the equipment number in
the
sub form.

To avoid this how could I get the equipment number to appear automatically
in the sub form when the user enters the number in the main form.

Rgds

Nora.

"BruceM" wrote:

A little more punctuation might have helped, but I think I get the idea.
Tables contain fields. Forms contain controls that are bound to the
table
fields. You need to establish the proper relationship between the
underlying tables. When that is done the linked field will not need to
be
populated through the subform, but will contain the same value as the
related field in the main table.
To see only the new record (and not be able to see previous records) set
the
form's (or subform's) data entry property to Yes. This setting is
located
in the form's Property Sheet (View Properties). To open to a new
record,
add the following to the form's Open event:
Me.Recordset.AddNew
I think DoCmd.GoToRecord , , acNewRec does the same thing. Not sure what
the difference is.
As for setting a field in the subform's record source to be the same as a
field in the main form's record source, there is probably no need. If
you
want to see the value of a field copied to the subform you could use code
to
refer to the control, but there are a lot of possibilities, and you have
provided few details.
More information is needed. It would help, too, if you describe a bit
more
about the database's purpose.

"Lisheen" wrote in message
...
HI All,

I am hoping someone can help, I have two problems with a subform. I
need
to
have a subform which is connected to the parent form by a field for
example
"code" field however I do not want the subform to automatically display
the
previous record for this "code" I want it do display a new record with
the
code field on the subform populated with the value entered in the
parent
code
field.


I also need to have set the value of a field on the subform to equal
that
on the parent form. For example if the item number on the parent field
is
entered as C118, I need the field on the subform to automatically equal
this
value. Is this possible as so far everything I have tried has failed.

Both problems are more or less the same but any help or guidance would
be
gratefully appreciated.






 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
unlinked subform Don Barton Database Design 5 May 20th, 2005 12:23 AM
Subform on Subform problem JohnB Using Forms 4 April 10th, 2005 12:52 PM
Form Subform data export [email protected] Using Forms 6 January 6th, 2005 06:25 PM
Subform Refresh Problem (but only with an unbound combo box control) Barry Skidmore Using Forms 1 December 21st, 2004 01:19 AM
dealing with a subform record when it's "dirty" Paul James Using Forms 8 October 17th, 2004 08:45 AM


All times are GMT +1. The time now is 07:04 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.