Passing data to a new entry in a second table (1 Viewer)

zebrafoot

New member
Local time
Today, 15:53
Joined
May 15, 2020
Messages
10
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?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 15:53
Joined
Jul 9, 2003
Messages
11,797
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.
 

zebrafoot

New member
Local time
Today, 15:53
Joined
May 15, 2020
Messages
10
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.
 

June7

AWF VIP
Local time
Today, 06:53
Joined
Mar 9, 2014
Messages
3,256
Might be less confusing if you don't use ID in foreign key field name or maybe suffix field name, such as OrderID_FK.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 10:53
Joined
Feb 19, 2002
Messages
29,179
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.
 

mike60smart

Registered User.
Local time
Today, 07:53
Joined
Aug 6, 2017
Messages
579
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 (Users: 0, Guests: 1)

Top Bottom