Strange relation/autonumber/paste problem...

M

Matt Schultz

This one requires some background info, so here goes...

Two tables: Sites and CallCard. Sites has a primary key autonumber called
SiteID. CallCard has a primary key autonumber CCID, with a foreign key to
Sites.SiteID (one-to-many, CallCard is the many).

One query: ActiveCards. Brings in all fields from CallCard by name and
Sites.Acronym, Sites.Subsite, Sites.POC.

One form: Based on ActiveCards, with all the fields it contains. There is a
combo box for CallCard.SiteID, created by dragging the field from the field
list, that shows Sites.SiteID and Sites.Acronym. The combo box is bound to
CallCard.SiteID.

Here's the issue. I can add new records on this form without problems. If
I try to copy an existing record in the form, though, things go crazy. I
select the record, hit Copy, then Paste Append. I get a message that there
is no match for SiteID in the 'one' table of the one-to-many relationship
(in this case, Sites). I can see behind the message that when it tried to
paste, though, it didn't keep the SiteID from the combo box, but is trying
to use the next available SiteID from the Sites table, as if it was trying
to create a new record there too.

I know I'm missing something, and it seems simple, but I can't get it.

Any help would be GREATLY appreciated. TIA!

Matt
 
K

Ken Snell

Doing a copy and paste when your form is based on a multiple-table query is
not a "good thing" to do.

Can you describe why you need to do a copy and paste? Likely there is
another way to do what you seek.
 
M

Matt Schultz

Ken,

I know it's not a "good thing" but those pesky users... ;-
)

Basically, the reason they want a copy/paste is because
usually when a record is added, it will be very similar
to another record that already exists.

I was hoping to "get away with" the coyp/paste, but it
looks like I'll have bite the bullet and "do it right"
with some VB coding. Any suggestions on that? Is there
a quick way to do what I want, or will it be create new
record, assign values from current record, etc.?

Thanks much!

Matt
 
K

Ken Snell

My suggestion: put a command button in the detail section that will be used
to "copy" the current record's fields' values into variables.

Then have a command button that will be used to "paste" (write) those values
into a new record's fields.

This way, you control what you are actually trying to paste into the new
record.
 
M

Matt Schultz

Good suggestion, Ken.

Thanks,
Matt



Ken Snell said:
My suggestion: put a command button in the detail section that will be used
to "copy" the current record's fields' values into variables.

Then have a command button that will be used to "paste" (write) those values
into a new record's fields.

This way, you control what you are actually trying to paste into the new
record.
 

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