keep value entered in previous form

T

txaggie992000

I am a very novice user of access...use it on and off so I don't stay
up-to-date like I should. I want to keep a bound value from a combo box that
I chose in the previous record for the following record.

I am entering a lot of data for the same "member" so I do not want to keep
entering the user from the combo box. I have read some threads that I
thought would help but nothing has been successful.
 
K

KLZA

try using the default value function of the field in question. you
can change it back later.
 
L

Linq Adams via AccessMonster.com

If you actually mean from a previous record (as KLZA is guessing, and I am,
too) rather than from a previous form, the syntax for the method he suggested
would vary, depending on the datatype of the bound field:

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. The syntax is slightly different, depending
on the datatype of the data:

For Date fields

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

For Text fields

Private Sub YourTextControlName_AfterUpdate()
If Not IsNull(Me.YourTextControlName.Value) Then
YourTextControlName.DefaultValue = """" & Me.YourTextControlName.Value &
""""
End If
End Sub

For Numeric fields

Private Sub YourNumericControlName_AfterUpdate()
If Not IsNull(Me.YourNumericControlName.Value) Then
YourNumericControlName.DefaultValue = Me.YourNumericControlName.Value
End If
End Sub

I've never used this on a combobox, but it should work just fine.
 
Top