Passing data to a new entry in a second table

That looks logical. So I assume that I could substitute the code you have:

.txtSubjectF2 = me.txtSubjectF1
.txtMessageF2 = me.txtMessageF1

with ContactID/OrderID or whatever I wanted to pass?
 
I would say that if you've got a field that ends in "ID" like "OrderID" then it is very likely that it is an auto number field generated automatically by Microsoft Access, which means you won't be able to update it, if that's what you're trying to do.
 
I would say that if you've got a field that ends in "ID" like "OrderID" then it is very likely that it is an auto number field generated automatically by Microsoft Access, which means you won't be able to update it, if that's what you're trying to do.

Appreciated. I merely want to use it a means of capturing a snapshot - so the ID fields (for example) would be a foreign key in the destination table.
 
Might be less confusing if you don't use ID in foreign key field name or maybe suffix field name, such as OrderID_FK.
 
Having the FK field name be IDENTICAL to the PK it points to is not confusing. Using the ID suffix for non-PK/FK fields IS confusing. So using EmployeeID to refer to the employee number generated by some other application is confusing. Calling it EmployeeCode or EmployeeNum would be much more appropriate and allow you to have an EmployeeID which IS an autonumber and is used as the PK for the employee table in YOUR application. The EmployeeNum would be kept as data and printed as the identifier on all reports/forms but EmployeeID would be used internally as the PK and for the FK of all rellationships. EmployeeNum in the Employee table should be defined with unique index = yes but the autonumber should be the PK of the table.
 
Hi again,

Thanks for taking the time to respond again. Apologies if I wasn't clear enough in my original question - I am a new access user so I really want to understand the underlying methodology for passing data between tables.

Let me try to explain the thinking behind what I want my database to do - the example I gave initially seems to have led to some confusion, so can we pretend for a moment that I never mentioned subtables! subforms!

I have a database of customers/opportunities/quotes/products etc. When a customer quote is made, I wish to make a FIXED record in a new table of the relevant details (e.g. price, applicable taxes, discounts etc) so that changes to the underlying tables will not affect the record I have made in the new table. However, the example I give here is irrelevant really; I just want to know if a form contains >1 piece of information that I wish to replicate elsewhere, how would I code a command to record the relevant variables temporarily, open a different form and drop the passed information in. I can see that OpenArgs may be a way to do this, but I'm struggling to find a good reference on the process.

I hope that's a clearer explanation, but if not, please say.

Best wishes,
Pete
Hi Pete

Rather than trying to store the same information in different Tables why not have a Control in the Subform that Indicates what Type of Record it is.

It can be Either a "Quote" or "Confirmed Sale" etc...
 

Users who are viewing this thread

Back
Top Bottom