Carry current value to new record

irade92

Registered User.
Local time
Today, 15:48
Joined
Dec 26, 2010
Messages
229
How do I carry forward the current value of a control so that it's automatically entered for all new records?
 
In your form, you can use the AfterUpdate event of the control holding your data to set the DefaultValue for the field. From that time forward, until you either manually change the data or close your form, the data will be entered automatically in each new record.
Code:
Private Sub YourControlName_AfterUpdate()
   Me.YourControlName.DefaultValue = """" & Me.YourControlName.Value & """"
End Sub
Linq ;0)>
 
Hi,
I need to carry 2 values to the next record.
I tried this method along with other recommendations I found elsewhere.
The first field is a date field. I succeeded to transfer it by using
Code:
Private Sub chkDate_AfterUpdate()
    Me![chkDate].DefaultValue = "#" & Me![chkDate].Value & "#"
End Sub

The second is a combobox. Here I'm having problems and after trying
Code:
Private Sub shift_AfterUpdate()
    Me![shift].DefaultValue = "" & Me![shift].Value & ""
End Sub
I keep getting this value in the combobox: #Name?

Anyone knows how to fix this???
 
Perhaps by trying the answer previously given in the thread?
Code:
Private Sub YourControlName_AfterUpdate()
   Me.YourControlName.DefaultValue = [B]""""[/B] & Me.YourControlName.Value & [B]""""[/B]
End Sub
You'll notice that there are Four (4) sets of quotation marks used both before and after the

& Me.YourControlName.Value &

part. This allows the code to be used regardless of the Datatype of the Field in question; it will even work for your Date Field.

Linq ;0)>
 
Thanks linq!!
I didn't notice there were 4 quotation marks...
 
As Aby Warburg said, "The devil is in the details!" :D

Linq ;0)>
 
Greetings,
I have followed instructions here and from Allen Brown's site for carrying forward values from specific controls to a new record. The instructions above also work very well for me except that after the form is closed and re-opened, these fields are blank.
I have the form set to open to the last record. Each control has an amount to it (numbers). When I click "new record" none of the controls with the carry forward after update works - the fields are blanks. If I fill them in again, then they do carry forward until the form is closed.
Is there something else that I need to do so that when the form re-opens and goes to a new record that it will carry forward the values from the last record of controls that have the AfterUpdate() to it.
I have spent hours trying to figure this out so any help is greatly appreciated!!!
Cheers, RMc
 

Users who are viewing this thread

Back
Top Bottom