Carry Forward text from last entered record

Rich_Lovina

Registered User.
Local time
Tomorrow, 08:56
Joined
Feb 27, 2002
Messages
224
In my database there are many instances where I need to carry forward the previously entered text for selected fields, so that data entry person need only tab through to enter data in selected new fields.

e.g. Field DeptCode may remain the same for 80 recs, whilst many other fields change; yet data enterer must be able to over-ride the previous record data as well, and then carry the new info forward.

Which option in properties handles this one?

Thanks in advance.
 
If you want to show the data from the last record every time a new record is entered then see this article:
http://support.microsoft.com/support/kb/articles/Q210/2/36.ASP?LN=EN-US&SD=gn&FR=0&qry=autofill&rnk=1&src=DHCS_MSPSS_gn_SRCH&SPR=ACC2000

Here is one method that will carry forward what was previously entered in a field. The first record will not be filled in automatically, but subsequent ones will during the time the form is open.

In the After Update event of the fields that you want to carry forward use this code:

Me![FieldName].Tag = Me![FieldName].Value

In the On Enter event of the fields put this code:

If Not (IsNull(Me![FieldName].Tag) Or Me![FieldName].Tag = "") Then
Me![FieldName].Value = Me![FieldName].Tag
End If
 
A fairly simple way is, in the AfterUpdate event of the control, set the default for that control as its current value. Here's an example of a text box containing a numeric entry. Note that the format will change slightly if referring to text or date (examples shown).

Private Sub FacilityID_AfterUpdate()
If Not IsNull(Me.FacilityID) Then
Me.FacilityID.DefaultValue = "=" & Me.FacilityID

'Use
'For text fields 'Me.Operatorid.DefaultValue = "='" & Me.OperatorID & "'"
'For date fields 'Me.Operatorid.DefaultValue = "=#" & Me.Operatorid & "#"
'For number fields 'Me.Operatorid.DefaultValue = "=" & Me.Operatorid

Me.FacilityID.TabStop = False
Else
Me.FacilityID.TabStop = True
End If

End Sub
 
Thanks greatly guys. Jack, presume I drop this new code in a line after my Propercase conversion line, in cases where I already have an [Event Procedure] running for the chosen field?
Sorry, very new (and frightened by) VB, but its working well where applied. Am reading the article but have not actually created Modules of my own so above code looks simpler to apply.
 
Just a minor problem. If I drop in new code in line under Propercase expression, I am getting error message.

I have tried putting it in new
Private Sub
....
End Sub
and still getting errors

In your
Me![FieldName].Tag = Me![FieldName].Value

Is Me 'My Dbase name' or 'My Form Name'

and also does the On Entry go in its own Private Sub?

Thanks for patience..and help.
 
I assume that you have code similar to his in your After Update event where I told you to put the code:

Me![FieldName] = StrConv(Me![FieldName], 3)

or something close to that. To add the code I posted you just add the line below the line above so it now reads:

Me![FieldName] = StrConv(Me![FieldName], 3)
Me![FieldName].Tag = Me![FieldName].Value

For the On Enter event just select [Event Procedure] from the drop down list and but this between the two code lines that you will find there:

If Not (IsNull(Me![FieldName].Tag) Or Me![FieldName].Tag = "") Then
Me![FieldName].Value = Me![FieldName].Tag
End If

If you still have a problem you can email me directly.

[This message has been edited by Jack Cowley (edited 10-21-2001).]
 

Users who are viewing this thread

Back
Top Bottom