Using Previous Record For Data Entry

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

For 4 of the 8 fields on a data entry form, I would like the info for the
last record entered in the current data entry session to pop up as the
default.

I've searched this discussion board and haven't found anything yet, so
please provide some guidance.

Thanks!!
 
This was asked two or three times in the last few days.

If I remember correctly, you put code in the field's after update event to
set that field's "default" to whatever the value is.

It might have been in the FormsCoding newsgroup.
 
I don't know how to use code. My friend suggested doing a query that returns
the last record for the 4 fields and I made it, but I'm not sure how to use
it as the Control Source for the fields... I go to expression builder and
select it and then click on the field and double click value so it says
Date «Expr» [Last Record]![Date] in the expression box
Should taht work? or what is wrong?
 
Not sure why you would build a query for this.

If you can't use code, then you are out of luck. It is pretty simple
though. Find the previous posts - they tell you exactly what to put in the
code.

Short of that just hit CTRL+' (apostrophe) when in any field to pull in
the value from the previous record.

--
Rick B



MooliiBeth said:
I don't know how to use code. My friend suggested doing a query that returns
the last record for the 4 fields and I made it, but I'm not sure how to use
it as the Control Source for the fields... I go to expression builder and
select it and then click on the field and double click value so it says
Date «Expr» [Last Record]![Date] in the expression box
Should taht work? or what is wrong?

Rick B said:
This was asked two or three times in the last few days.

If I remember correctly, you put code in the field's after update event to
set that field's "default" to whatever the value is.

It might have been in the FormsCoding newsgroup.
 
Is it impossible to pull a default value from a query?

Rick B said:
Not sure why you would build a query for this.

If you can't use code, then you are out of luck. It is pretty simple
though. Find the previous posts - they tell you exactly what to put in the
code.

Short of that just hit CTRL+' (apostrophe) when in any field to pull in
the value from the previous record.

--
Rick B



MooliiBeth said:
I don't know how to use code. My friend suggested doing a query that returns
the last record for the 4 fields and I made it, but I'm not sure how to use
it as the Control Source for the fields... I go to expression builder and
select it and then click on the field and double click value so it says
Date «Expr» [Last Record]![Date] in the expression box
Should taht work? or what is wrong?

Rick B said:
This was asked two or three times in the last few days.

If I remember correctly, you put code in the field's after update event to
set that field's "default" to whatever the value is.

It might have been in the FormsCoding newsgroup.

--
Rick B



For 4 of the 8 fields on a data entry form, I would like the info for the
last record entered in the current data entry session to pop up as the
default.

I've searched this discussion board and haven't found anything yet, so
please provide some guidance.

Thanks!!
 
WEll, a query could be run to pull up the last record entered, but you still
have to do something with that data. A control's "default" is just one of
it's properties. You might be able to go into that and put a DMX statemt to
pull up the last record and use a value from a field, but then you are going
way past simply placing a string in the control's default using three lines
of visual basic code in a control before update event.

You'r making this difficult and it's not.

Just find the previous post (there are tons out ther) and follow the
instructions.

You will go into design view, click the control (field) you want to default.
In the "before update" event you will select "event procedure" from the
drop-down list. You'll then click the elipse to open the code builder and
you'll type in what they give in that post. You will have to change the
names to match your data.

It is not tuff.

Don't let it scare you just because the word "code" is in there.

--
Rick B



MooliiBeth said:
Is it impossible to pull a default value from a query?

Rick B said:
Not sure why you would build a query for this.

If you can't use code, then you are out of luck. It is pretty simple
though. Find the previous posts - they tell you exactly what to put in the
code.

Short of that just hit CTRL+' (apostrophe) when in any field to pull in
the value from the previous record.

--
Rick B



MooliiBeth said:
I don't know how to use code. My friend suggested doing a query that returns
the last record for the 4 fields and I made it, but I'm not sure how
to
use
it as the Control Source for the fields... I go to expression builder and
select it and then click on the field and double click value so it says
Date «Expr» [Last Record]![Date] in the expression box
Should taht work? or what is wrong?

:

This was asked two or three times in the last few days.

If I remember correctly, you put code in the field's after update
event
to
set that field's "default" to whatever the value is.

It might have been in the FormsCoding newsgroup.

--
Rick B



For 4 of the 8 fields on a data entry form, I would like the info
for
the
last record entered in the current data entry session to pop up as the
default.

I've searched this discussion board and haven't found anything yet, so
please provide some guidance.

Thanks!!
 
Place this code in your main forms On Current. Replace my controls and
fields ([cboEID] & [EID]) with yours...Randy

Dim rs As Object
Set rs = Me.Recordset.Clone

If rs.EOF Or Not Me.NewRecord Then
' don't do anything if there's no records or it is not a new record
Else
With rs

.MoveLast

Me![cboEID] = .Fields("EID")
Me![CurrentDate] = .Fields("Current_Date")
Me![Dist_Id] = .Fields("District_ID")
End With

End If



Rick B said:
WEll, a query could be run to pull up the last record entered, but you
still
have to do something with that data. A control's "default" is just one of
it's properties. You might be able to go into that and put a DMX statemt
to
pull up the last record and use a value from a field, but then you are
going
way past simply placing a string in the control's default using three
lines
of visual basic code in a control before update event.

You'r making this difficult and it's not.

Just find the previous post (there are tons out ther) and follow the
instructions.

You will go into design view, click the control (field) you want to
default.
In the "before update" event you will select "event procedure" from the
drop-down list. You'll then click the elipse to open the code builder and
you'll type in what they give in that post. You will have to change the
names to match your data.

It is not tuff.

Don't let it scare you just because the word "code" is in there.

--
Rick B



MooliiBeth said:
Is it impossible to pull a default value from a query?

Rick B said:
Not sure why you would build a query for this.

If you can't use code, then you are out of luck. It is pretty simple
though. Find the previous posts - they tell you exactly what to put in the
code.

Short of that just hit CTRL+' (apostrophe) when in any field to pull in
the value from the previous record.

--
Rick B



I don't know how to use code. My friend suggested doing a query that
returns
the last record for the 4 fields and I made it, but I'm not sure how to
use
it as the Control Source for the fields... I go to expression
builder and
select it and then click on the field and double click value so it says
Date «Expr» [Last Record]![Date] in the expression box
Should taht work? or what is wrong?

:

This was asked two or three times in the last few days.

If I remember correctly, you put code in the field's after update event
to
set that field's "default" to whatever the value is.

It might have been in the FormsCoding newsgroup.

--
Rick B



message
For 4 of the 8 fields on a data entry form, I would like the info for
the
last record entered in the current data entry session to pop up
as the
default.

I've searched this discussion board and haven't found anything yet, so
please provide some guidance.

Thanks!!
 
Back
Top