I want to automatically enter data from one field into other field

K

kwinbo

I have a database where I must record the dates certain events occur. Many
events in a single record will often occur on the same dates. Using the
AfterUpdate event on the initial field where this date occurs, I've attempted
to set my form to enter the date from that field into the other fields that
will use the same date. I did this by creating a macro called CopyContents
with the syntax:

Item:
[Forms]![Entry Form]![Latch Plate] & [Forms]![Entry Form]![Pipe] &
[Forms]![Entry Form]![Figerglass Rods] & [Forms]![Entry Form]![Install
Latches]

and Expression:
[Forms]![Entry Form]![Text48]

This works fine when I tell it to copy to a single field: i.e.:
Item: [Forms]![Entry Form]![Latch Plate]
Expression: [Forms]![Entry Form]![Text48]

but when I try to add the additional fields to the Item statement, I get an
error message on the form telling me I can't enter data in the initial field.
I assume it has something to do with the way I'm appending the additional
fields to the original statement. I've tried using commas, semi-colons, and
ampersands with and without spaces, all to no avail.
What's the correct syntax to accomplish this?
Help....
 
S

Steve Schapel

Kwinbo,

What you are attempting to do is not possible. You will need to define
a separate SetValue action for each field.
 
K

kwinbo

Thanks, Steve, it worked wonderfully.
I didn't understand exactly what you meant when I first read the post. I
thought I was going to have create a new macro for each field. I got it,
though, when I went back into the original macro and saw all those lines for
additional actions.
(I'm a complete novice. Does it show?)
Thanks again.

Steve Schapel, Microsoft Access MVP

Steve Schapel said:
Kwinbo,

What you are attempting to do is not possible. You will need to define
a separate SetValue action for each field.


I have a database where I must record the dates certain events occur. Many
events in a single record will often occur on the same dates. Using the
AfterUpdate event on the initial field where this date occurs, I've attempted
to set my form to enter the date from that field into the other fields that
will use the same date. I did this by creating a macro called CopyContents
with the syntax:

Item:
[Forms]![Entry Form]![Latch Plate] & [Forms]![Entry Form]![Pipe] &
[Forms]![Entry Form]![Figerglass Rods] & [Forms]![Entry Form]![Install
Latches]

and Expression:
[Forms]![Entry Form]![Text48]

This works fine when I tell it to copy to a single field: i.e.:
Item: [Forms]![Entry Form]![Latch Plate]
Expression: [Forms]![Entry Form]![Text48]

but when I try to add the additional fields to the Item statement, I get an
error message on the form telling me I can't enter data in the initial field.
I assume it has something to do with the way I'm appending the additional
fields to the original statement. I've tried using commas, semi-colons, and
ampersands with and without spaces, all to no avail.
What's the correct syntax to accomplish this?
Help....
 

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