Fill a field from the previous record

  • Thread starter Thread starter Bruce Rodtnick
  • Start date Start date
B

Bruce Rodtnick

I want to fill in one (1) text box with data from the previous record
(same text box). I've used the code from:
http://support.microsoft.com/default.aspx?scid=kb;en-us;210236 and it
works fine on the form by itself, but this form is a subform. This
method uses =AutoFillNewRecord([Forms]![MyForm]) in the OnCurrent
property for the form. How do I make this work on the sub form?

Bruce Rodtnick
 
Bruce said:
I want to fill in one (1) text box with data from the previous record
(same text box). I've used the code from:
http://support.microsoft.com/default.aspx?scid=kb;en-us;210236 and it
works fine on the form by itself, but this form is a subform. This
method uses =AutoFillNewRecord([Forms]![MyForm]) in the OnCurrent
property for the form. How do I make this work on the sub form?

Bruce Rodtnick


You might like to try the following single line of vba code in the
After Update event of your text box:

Me![txtName].DefaultValue = """" & Me![txtName].Value & """"

where txtname id the name of the textbox where ytou want the data
repeated from record to record.

There are 4 double quotes at each end!


hth

Hugh
 
What a GREAT! idea. Thanks. just what I want!
Bruce said:
I want to fill in one (1) text box with data from the previous record
(same text box). I've used the code from:
http://support.microsoft.com/default.aspx?scid=kb;en-us;210236 and it
works fine on the form by itself, but this form is a subform. This
method uses =AutoFillNewRecord([Forms]![MyForm]) in the OnCurrent
property for the form. How do I make this work on the sub form?

Bruce Rodtnick

You might like to try the following single line of vba code in the
After Update event of your text box:

Me![txtName].DefaultValue = """" & Me![txtName].Value & """"

where txtname id the name of the textbox where ytou want the data
repeated from record to record.

There are 4 double quotes at each end!

hth

Hugh
 
Bruce said:
What a GREAT! idea. Thanks. just what I want!
Bruce said:
I want to fill in one (1) text box with data from the previous
record (same text box). I've used the code from:
http://support.microsoft.com/default.aspx?scid=kb;en-us;210236
and it works fine on the form by itself, but this form is a
subform. This method uses =AutoFillNewRecord([Forms]![MyForm])
in the OnCurrent property for the form. How do I make this work
on the sub form?

Bruce Rodtnick

You might like to try the following single line of vba code in the
After Update event of your text box:

Me![txtName].DefaultValue = """" & Me![txtName].Value & """"

where txtname id the name of the textbox where ytou want the data
repeated from record to record.

There are 4 double quotes at each end!

hth

Hugh


You're welcome.

Hugh
 
Back
Top