Default previous value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I found no satisfactory answer so far to the following problem:
Is there a simple way of entering a record in a form with repeated values
for all the variables as the previous record? This would make data entry
much easier for our research project.
Thanks in advance
 
In the AfterInsert event of the form, you could set the DefaultValues for
the various text boxes to the value that's currently in them:

Private Sub Form_AfterInsert

Me.txtField1.DefaultValue = Chr$(34) & Me.txtField1 & Chr$(34)
Me.txtField2.DefaultValue = Chr$(34) & Me.txtField2 & Chr$(34)
Me.txtField3.DefaultValue = Chr$(34) & Me.txtField3 & Chr$(34)

End Sub

However, I have to question your need for this capability. Having multiple
rows with the same value seems very unusual. Are you sure you've normalized
the database properly?
 
Juanjo said:
I found no satisfactory answer so far to the following problem:
Is there a simple way of entering a record in a form with repeated values
for all the variables as the previous record? This would make data entry
much easier for our research project.
Thanks in advance

No *simple* way that I'm aware of, I think you'd have to open the recordset
in code and read the contents of the last record to apply them as default
values. Could be messy if you have a lot of fields.

Keith.
www.keithwilby.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top