Subform refreshing Problem

Researcher

I.T. Veteran
Local time
Today, 13:48
Joined
Oct 11, 2006
Messages
42
I have a form used to enter dates and time tables for events. Within this form i would like to add a subform and display the last record entered whenever I choose to add a new record.

What is the best way using code to put this together? I have seen a few examples here, but Im not quite getting it to work. Can someone suggest the best approach?

Thanks in Advance...

Researcher
 
Do you have your records sequenced in some fashion? Access does not keep track of the order entered and can easily return them in an odd sequence. What field would you use to identify the "last record entered" ?
 
Records Sequenced?

Do you have your records sequenced in some fashion? Access does not keep track of the order entered and can easily return them in an odd sequence. What field would you use to identify the "last record entered" ?

Hello Rural guy, yes I have used a date field to group/sort by
 
You could use a DMax() to get the last record then and display it. Are you thinking you will add another record on a SubForm that only has the last record already displayed? That could get tricky. You could use two SubForms that are made to look like one and the top one displays the previous record and the other SubForm is in Data entry mode.
 
Subform refreshing to view previous entry

You could use a DMax() to get the last record then and display it. Are you thinking you will add another record on a SubForm that only has the last record already displayed? That could get tricky. You could use two SubForms that are made to look like one and the top one displays the previous record and the other SubForm is in Data entry mode.

Actually, I only want the subform to display the last record I enter on the main entry form each time I enter a new record, but only displaying one record at a time. Is refreshing necessary for me to see each new entered record? I have seen many of your threads posted here, would you have some code I could put behind the form or subform, wherever it needs to go?

Any examples would be greatly appreciated..

Regards,

Researcher
 
Can you use the Query Builder to create a query that *only* selects your "last" record entered? If so then you can make that the RecordSource for the SubForm and Requery it whenever you need to.
 
Subform refreshing

Can you use the Query Builder to create a query that *only* selects your "last" record entered? If so then you can make that the RecordSource for the SubForm and Requery it whenever you need to.

Yes, my subform is based on a query where I select the totals button and group by "last" on the date field. The only way I can see the new data entered in the subform is to select design view and then view again on the subform. I tried using a requery option in a macro and then in the afterupdate event of the main form, but it did not change anything.

BTW, the fields in the subform and main form are identical, but the subform has one name and the main form has another. I have not tried the DMAX option yet, but will attempt to. If you have any further recommendations, please suggest...
 
Your MainForm must save its record for the SubForm to see it. Have you tried a Requery of the SubForm?
Me.SubFormControlName.FORM.Requery
...using your SubFormControlName of course. It may not be named the same as the Form it is displaying.
 
I would probably use the Current event of the MainForm for requerying the SubForm since there will not be any LinkChild/MasterFields entries.
 

Users who are viewing this thread

Back
Top Bottom