Autofill similar to Excel Feature

mr moe

Registered User.
Local time
Today, 10:41
Joined
Jul 24, 2003
Messages
332
Guys,
Can someone help in this, is there a way to create an autofill feature similar to excel. For example if typed a value in the previous record and when i start typing it again, i want it to auto fill it just like excel. Thanks.
 
None that I've ever seen, and I see the question two or three times every month! You can, however, have a field autofilled with the value you entered in the same field in the previous record, using the field's DefaultValue. The exact code depends on the datatype of the field:

For Text fields


Code:
Private Sub YourTextControlName_AfterUpdate()
If Not IsNull(Me.YourTextControlName.Value) Then
  YourTextControlName.DefaultValue = """" & Me.YourTextControlName.Value & """"
End If
End Sub
For Numeric fields

Code:
Private Sub YourNumericControlName_AfterUpdate()
If Not IsNull(Me.YourNumericControlName.Value) Then
  YourNumericControlName.DefaultValue = Me.YourNumericControlName.Value
End If
End Sub
For Date fields

Code:
Private Sub YourDateControlName_AfterUpdate()
If Not IsNull(Me.YourDateControlName.Value) Then
  YourDateControlName.DefaultValue ="#" &  Me.YourDateControlName & "#"
End If
End Sub

Linq
 

Users who are viewing this thread

Back
Top Bottom