I need a field in a subform to auto fill with value from same field in previous rec.

Davepacey

Registered User.
Local time
Today, 13:47
Joined
Feb 19, 2003
Messages
22
Hi Folks,
Is it Possible to get a field in a subform to fill with the value of the same field in previous record......easy with Alpha Five !! and then to recognise when the value has changed.
I have to do this without using linked fields to the mainform, as the data can change from record to record. (some fields are linked, and do fill as required) Not sure if this is possible.
i.e. the subform is linked on a [batch_number] field between child and parent. This batch number can remain the same over several shifts, which means the date can change, as can the shift. I would like to not have to type in the date and shift for every record entered in the subform, bearing in mind that the records may be typed in several days after the event, and they may be lots of them !
two of the fields are [month] format "mmmm"and [year] "yyyy", I guess it should be possible to fill those with some sort of function based on the date field "dd/mm/yyyy" ?

I have tried searching the posts, can find nothing that suits.

TIA

Dave
 
In the data sheet view control-apostrophe does the trick.

If a form view, on BeforeUpdate event, store your textbox value in the textbox field's tag (property), then Oncurrent event (new record), if the field is Null get the value from it's tag.

Specifically

Form_BeforeUpdate
Me!Yourfield.tag = me!Yourfield


Form OnCurrent
if me!Yourfield & "" = "" then me!Yourfield = Me!Yourfield.Tag
 
Thanks, I managed it using method below.

I managed to get it by adding combo boxes on the main form, and referencing them in the default value properties of the field in the subform, and just as long as the combo boxes are changed before moving to next record, it works just fine.

Dave
 

Users who are viewing this thread

Back
Top Bottom