previous values

J

Jason

Hello,

I was wondering how i can insert values from the previous record in a form?

This is what the subform must do when a new record is being inserted:

- set the default value for example 3 textboxes
- then when another record with differtent value than the previous one, the
default values must also change.

I hope someone can help me?
 
J

John Vinson

Hello,

I was wondering how i can insert values from the previous record in a form?

This is what the subform must do when a new record is being inserted:

- set the default value for example 3 textboxes
- then when another record with differtent value than the previous one, the
default values must also change.

I hope someone can help me?

One way you can do this involves just a single line of VBA code. In
the AfterUpdate event of each textbox that you want to carry forward,
put code like

Private Sub txtThisBox_AfterUpdate()
Me!txtThisBox.DefaultValue = Chr(34) & Me!thisTextBox & Chr(34)
End Sub


John W. Vinson[MVP]
 
J

John Vinson

Hi John,

Thnx for the help, but what is chr(34)?

Sorry! Should have explained. It's " - the doublequote character. The
Default property of a control must be a String so this ensures that
it's interpreted as such.

John W. Vinson[MVP]
 

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

Top