Basing one data entry form on a previous record

J

Josh

Hello, I have been searching the forums for a solution to this problem and
have not seen anything that helps me out.

I am creating a data entry form that requires the user to make multiple
entries per associate each day. I was trying to streamline this process by
including a check box (or other control) that would copy some of the repeated
fields such as employee ID, date and number of hours worked during the shift
and copy this information onto the next record entry (so that it does not
need to be subsequent times). This repeated data then would be reposted in
the blank form to simplify this process for those who will do the data entry.

To clarify things, the process currently goes like this.

1)Associate enters form information
2)Associate clicks 'next record' command button
3)Associate enters another record for this associate, re-entering all
overlapping information (until all records have been entered)
4)Associate continues until all records for all associates have been entered.

The ideal process would be like this.

1)Associate enters form information
2)Associate clicks check box ('Next Entry Is For The Same Associate') and
then clicks the 'next record' command button.
3)Associate now only has to enter a the remaining fields that change for
each record. Steps 2 and 3 are then repeated until all information for this
associate has been entered.
4)Associate continues until all records for all associates have been entered.

Any help would be great.

Thanks
 
A

Allen Browne

See:
Assign default values from the last record - Carry data over
at:
http://allenbrowne.com/ser-24.html

The article contains the code to duplicate the existing fields when you
start entering a new record. It's smart enough not to try duplicating the
AutoNumber, or any unbound controls, or any controls bound to expressions.
You can also specify exceptions (fields not to duplicate.)

You don't need to rewrite the code for your particular form: it's
copy'n'paste stuff.
 
J

Josh

Thank you for your prompt assistance.

I am having one problem though. When I compile the code, on this line "Call
CarryOver(Me, strMsg)," I am receiving a message that this is an invalid use
of Me keyword.

Any help is greatly appreciated.

Thanks
 
J

Josh

Sorry, I made a mistake when entering the code. I greatly appreciate your
help.

I have another question, would it be ok to start that here, or should I
create a new post?

Thanks for your help.
 
A

Allen Browne

In what context are you trying this?

The code is designed to be used in the BeforeInsert event procedure of a
bound form. "Me" is valid in that context.
 
J

Josh

With your help, things are working. I have a few questions though...

First, I don't want to carry over values all of the time. I was hoping that
there was a way to allow the end user the ability to determine whether or not
they were going to be making multiple entries for a single employee. I was
thinking that a check box control would be ideal, but I am sure that you know
better than I.

Second, in the case of the first entry in the form, I receive a message that
says that there are no previous records to duplicate. While this is true,
again, I was hoping that I could avoid this by allowing the user to determine
whether or not the record that they are currently entering should be carried
over or not (i.e. I don't want it to carry over every time).

Thanks again for your help.
 
A

Allen Browne

You could add an unbound text box named (say) chkCarryOver.

Then change for Form_BeforeInsert event to:
If Me.chkCarryOver.Value Then
Call CarryOver(Me, strMsg)
'etc
End If

Re number 2, remove the line:
strErrMsg = strErrMsg & "Cannot carry values over. Form '" & strForm &
"' has no recrods." & vbCrLf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top