Subform

Vulcan1500

Registered User.
Local time
Today, 19:54
Joined
Nov 13, 2007
Messages
143
Form invoice has a subform that can show max 6 records. Once more records are involved I want to show the last 6 including the new empty record. Any suggestion how to do that?
 
Increase the height of the subform.
or
decrease the height for the detail area of the subform

In the subform Open event use this
DoCmd.GotoRecord ,,acNew (not very sure about the exact syntax for this statement but very sure that I am very close :) )
 
Increasing the window is not an option. The subform may have 1 record for a invoice and 100 for another. I just want to controll the records that are in view. If the form (parent) is opened the first 6 records (max of subform) are shown and using the scrollbar the next records come in view.
The proble I encounter is that once I add a record and I click on the next empty record an after update event is triggered. This event does a requery of the subform, some controls of the parent and goes to a new record in the subform. At that point only the new record is at the top of the view of the subform and I would like to have this at the bottom. In that situation I would see the last 5 records and the new one.
 
And still have the possibility to scroll up and see all the others?
 
I think that this time I understand your request.
See the attachment. Is this what you are looking for ?
 

Attachments

You did a lot of work to answer my question. Thanks for that! You introduced a button to requery. I was trying to do the same, but using the on update event. I presume this is a better solution.

Two questions:
1. what means the underscore '_' in code Form_frmScroll.GoToNewRecord
2. how did you manage to change background in records

I'm still suffering to update 3 controlls in parent.
 
You did a lot of work to answer my question.
:) Not exactly. I already have the DB (it was an answer for other thread). I only designed the forms and write the code.
You introduced a button to requery. I was trying to do the same, but using the on update event. I presume this is a better solution.
Of course. My button was only for simulate your situation.
what means the underscore '_' in code Form_frmScroll.GoToNewRecord
Open the VBA editor. Open the Project Explorer window (CTRL+R). Here you will see the names that VB automatic give for your forms: Form_FormName
how did you manage to change background in records
Open the form (frmScroll in this case) in design view.
Show the property sheet - Format tab
Select the Detail section of the form (click on the Detail bar)
Now, in the Property sheet you have a row: Alternate Back Color. This is the answer.
I'm still suffering to update 3 controlls in parent
?????????
 
after clicking you button I have added:
Me.Parent.[TotalExVAT].Requery
Me.Parent.[TotalVAT].Requery
Me.Parent.[TotalInVAT].Requery
to update these three values
 
What the Parent is ? Who's parent ? The brackets say me that this are fields. On the other hand, a field can't be requery. Only some controls like Forms, List boxes, Combo boxes, Subforms ... any control that has as Row Source a query (that show a recordset).
 
I wasn't clear, but it's difficult for a biker to explain to the engineer what the problem is with his bike.

child is e.g. your frmScroll (my invoice details)
parent is your frmTest (my invoice)
records in detail is a list of works individual priced
once the button is pushed I also want to update 3 fields, being the total of the details: Total excluding VAT, Total VAT and Total including VAT
the formulas to do these calculations are given in these fields
these fiels now only get values when I leave the form and re-open it

hopefully I'm more clear now
 
I hope that what I understanding to not be the true.
Post a pick with your DB relationships.
 
Thanks for all your time Mihail and I try to eplain my question with other words.

My form is an invoice (parent) with a subform having the details (child) of this invoice (each record contains an individual priced item). Your example has this relation between frmTest and frmScroll.

- I want to display on frmTest the sum of RepeatDays of frmScroll when button Requery is used.
- Is it possible to include an event while data is entered in frmScroll that does the same as using button Requery?
- Is 'Form_' the same as 'Form!'?
 
Is 'Form_' the same as 'Form!'?
Not sure but you can try.

I ask you to take a screen shot from the Relationship window and to post it.
This way I'll see the fields in your tables and how this tables are related.
I suspect that you try to accomplish a task that require 3 tables but you have only 2.
Also I suspect that you try to store a calculated value in the table - and this is a very bad practice that should be (and always CAN be) avoid.

So, show us the relationships and size the tables windows as much as possible (and necessary) in order to see the all the fields.

Is it possible to include an event while data is entered in frmScroll that does the same as using button Requery?
I think that the After Update is what you are looking for.
 

Users who are viewing this thread

Back
Top Bottom