Discussion Locked

MS Access 2000 Data Field Transfer

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am creating an entry form for tracking mailings. When the mailing goes out the operator will enter the date of the mailing into a field on the form which corresponds to a table field called "DATEMAILED". The next time there is something mailed, I need for the new date to be entered into "DATEMAILED" and the old date to be transferred to a field named "LASTDATEMAILED". Is this possible?

P.S. I know nothing about macros if this is the way to go.

4 replies

by richtee

One way to do what you want is as follows:

Add a command button to your form (to use the following code, name the control: ?cmdNewMailing?).

Add the following code to the Click event for this command button:

Private Sub cmdNewMailing_Click()

On Error GoTo Err_cmdNewMailing_Click

Dim dte As Date

dte = DATEMAILED
LASTDATEMAILED = dte
DATEMAILED.SetFocus
DATEMAILED.Text = ""

Exit_cmdNewMailing_Click:
Exit Sub

Err_cmdNewMailing_Click:
Resume Exit_cmdNewMailing_Click

End Sub
When a new mailing occurs, click the command button and the date in the ?DATEMAILED ? field will transfer (and replace) the value in the ?LASTDATEMAILED? field.

The code will also prevent the ?LASTDATEMAILED? from being overwritten if the ?DATEMAILED? field is empty.

Good Luck. Contact me if you additional assistance for how to put the code in the click event.

Rich

This discussion is closed to new replies.