Tag Issues (1 Viewer)

munkeyroot

Registered User.
Local time
Today, 23:17
Joined
Jan 13, 2011
Messages
76
Hey everyone

I have been trying to do an append query to duplicate my frm_main and all my subforms on a command button.

i found this on the net from MSoft
https://support.microsoft.com/en-gb/help/20...-detail-records

ok so i have copied this to the letter .... i think ... just obviously changed the table names to fit my DB. orders = frm_main orderdetails = mysubform

so when it comes to the append Query of my task, is says to:
"Delete OrderID from the Append To row of the OrderID column and type the following line in the Criteria row: [Forms]![Orders].[Tag]

This criteria selects the detail records where the OrderID is the value found in the Orders form's Tag property, the source OrderID."

ok so i changed it to my "frm_main" [Forms]![frm_main].[Tag]

so now when i click the duplicate button on my form it will copy the main form over ok but then get and INSERT INTO message

"The INSERT INTO statement contains the following unknown Field name: "forms!frm_main.Tag"

I've put the append query on here to show what i have done so far
RolesSelect_ID is PK and Main_ID is FK

any thoughts guys?

munk
 

Attachments

  • Append query.JPG
    Append query.JPG
    45.1 KB · Views: 109

Orthodox Dave

Home Developer
Local time
Today, 23:17
Joined
Apr 13, 2017
Messages
218
Hi Munk,

Assuming you are duplicating the main record and the ID of that record is MainID, and MainID is an autonumber field, you shouldn't be attempting to update it at all - it will automatically produce a value when you append the new record.
 

munkeyroot

Registered User.
Local time
Today, 23:17
Joined
Jan 13, 2011
Messages
76
Hi Orthodox
thanks for the comment

Yes the main_id is PK auto num for the main page.
However the subform has a relationship to the 1toM Main_ID which takes the auto PK and places it in the Main_ID FK on the subform table.

which the script as i have is saying
"after duplicating the frm_main into New, copy the new main_id PK in TAG and place it in the main_id FK."

However the append query cannot see the "form!frm_main.Tag" even though the tag is set for MAIN_ID on the forms Property sheet.

So letting the append query do its thing it will only duplicate to itself as is copies the Main_ID if the original. hes you have two duplicate records of the subform. because that is what it suppose to do.

if this is the case i need to somehow tell the append query to use the main_id number i want to copy them to.
 

Orthodox Dave

Home Developer
Local time
Today, 23:17
Joined
Apr 13, 2017
Messages
218
so when it comes to the append Query of my task, is says to:
"Delete OrderID from the Append To row of the OrderID column and type the following line in the Criteria row: [Forms]![Orders].[Tag]

But in the picture you attached, you put "[Forms]![Orders].[Tag]" in the Append row not the Criteria row. No wonder it can't find it.
 

Users who are viewing this thread

Top Bottom