new record previous info

tubar

Registered User.
Local time
Today, 15:20
Joined
Jul 13, 2006
Messages
190
i have a form that tells me all the lights used in 1 area when i input a record some of the data will be new (the type of light) but one field will be the same (the area im documenting). what is the code or expresion and/or event
 
A built in keyboard shortcut is: ctrl and ' to copy the data form the previous record.

To make it automatic, you might try using the control's After Update event to save the current value in the control as the control's default value.

Example assuming the value is numeric:

Code:
Private Sub YourTxtboxName_AfterUpdate()
    Me.YourTxtboxName.DefaultValue = Me.YourTxtboxName
End Sub

it text then use:


Code:
Private Sub YourTxtboxName_AfterUpdate()
    Me.YourTxtboxName.DefaultValue = Chr(34) & Me.YourTxtboxName & Chr(34)
End Sub
 
Last edited:
Actually, after years of using slightly different syntax, as you've demonstrated, Boyd, depending on the datatype involved, I found out that

Code:
Private Sub YourTxtboxName_AfterUpdate()
   Me.YourTxtboxName.DefaultValue = """" & Me.YourTxtboxName.Value & """"
End Sub

can be used regardless of the datatype! I was most surprised! :D
 
Actually, after years of using slightly different syntax, as you've demonstrated, Boyd, depending on the datatype involved, I found out that

Code:
Private Sub YourTxtboxName_AfterUpdate()
   Me.YourTxtboxName.DefaultValue = """" & Me.YourTxtboxName.Value & """"
End Sub

can be used regardless of the datatype! I was most surprised! :D

missinglinq,

That is interesting. Access must be handling the data type conversion automatically for the default value when it is literal string.

I will give that a try.

Thanks for the tip! :)
 
As I said, having used different syntax for years, depending on the datatype, I was amazed. I run 2003, and don't have anyway to test it in previous versions.
 

Users who are viewing this thread

Back
Top Bottom