Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only one record in a subform per main record

Status
Not open for further replies.

longbillduck

Technical User
Sep 26, 2001
29
US
Only one record in a subform per main record.


I have a form, with a subform
The form is based off a linked table

The main form shows a sales order number, with product number and product quantity ordered

The subform is related back to the main form by the sales order number, product number and quantity, plus there are 6 additional fields where the person can enter numbers that will sum to the quantity ordered. (This information will be used to generate a report listing quantizes of product number per pallet)

In my subform, I need to only allow the fields in the subform to be populated for the just one record as related to the main form record

When I advance to the next main record, a new single subform record would display.

Can this be done? Thanks in advance for any help

Art
 
Hi Art

There are some things unclear:
The subform is related back to the main form by the sales order number, product number and quantity
A form-subfrom can only be linked by one field. You have to define the following properties for the subform control: Link Child Field and Link Master Field [blue](which subfrom field should be linked to which mainform field.

If they are linked properly, then the subform should automatically be filtered to the record of the mainform.
When I advance to the next main record, a new single subform record would display.
Is your that your subform [blue](= the actual form of your subform-control)[/blue] is bound to table?
If so, "a new single subform record would display" only if you still don't have in your subform table any record(s) related to the record in your main form.

Hope we get a little clearer...
Ja
 
Ja,
A form-subfrom can only be linked by one field.

Since when?
help file said:
You can use the name of a control (including the name of a calculated control) to set the LinkMasterFields property, but you can't use the name of a control to set the LinkChildFields property. If you want to use a calculated value as the link for a subform, subreport, or embedded object, define a calculated field in the child object's underlying query and set the LinkChildFields property to the field.

When you specify more than one field or control name for these property settings, you must enter the same number of fields or controls for each property setting and separate the names with a semicolon (;).
 
How are ya longbillduck . . .

Your post origination ia a little unclear. [surprise]

Do you want just a single [blue]New Record[/blue] data entry line, or the same with say, the last record entered as well?

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 


Hi, (I just got back to my desk...)

@longbillduck
things are still a little unclear (even TheAceMan1 agreed...)

@MajP:
Thank you for the enlightenment. I must admit, it is really something new I have learned...

Ja
 
Thanks all for the information

Sorry, I shouldn't have posted unless I knew I could get back sooner

Anyway, I've got my subform to allow only one record by adding the following to my subform:

If Me.Recordset.RecordCount > 0 Then
Me.AllowAdditions = False
Else
Me.AllowAdditions = True
End If


but now, when I advance to the next record on the main form, my subform goes away

Any thoughts?
 
longbillduck . . .

Have a look at the forms [blue]Data Entry[/blue] property!

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top