Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set default table field value as previous record field 1

Status
Not open for further replies.

bfamo

Technical User
Feb 16, 2006
132
NO
Hi!

I have a table (TblRegist) with a field called "NC1". The content of "NC1" repeats itself over an over, and I whould therefore like to set the fields default value to the same as the previos (must be previous) field in the table.

I'm sure you guys know what expression to use here :)

Thanks!
 
You can use the after update event of a text box to set the default value to the current value. You can also train users to press Ctrl+' to automatically insert the previously entered value.

Code:
Private Sub Description_AfterUpdate()
    Me.Description.DefaultValue = """" & Me.Description & """"
End Sub

Private Sub NumberField_AfterUpdate()
    Me.NumberField.DefaultValue = Me.NumberField
End Sub

Duane
Hook'D on Access
MS Access MVP
 
Thanks dhookom!

From what I understand, there is no way to do this in the table field options?
The subform that contains "NC1" is shown in datasheet view, so there is no way to use code to solve this.

 
Sorry, my mistake! I CAN use code, this is afterall a form.

Thanks so much for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top