MS Access add button to form to create new record for specific table - forms

I have a tabbed form in Access 365 with 2 tabs - the first tab displays fields from Table A and the second tab has fields from Table B. There is a 1 to N relationship defined between Table A and Table B. The primary key (autonumber) from Table A ('ID_TableA') has been copied to Table B and this field is used to define the 1 to N relationship. See below for fields in both tables. Currently if I enter data in the second tab for Table B, the 'ID_TableA' value in Table B will be assigned the value of the 'ID_TableA' in the Table A record the form is currently on.
How can I use the second tab in my form to create multiple records in Table B that relate to one record in Table A? I'm thinking adding a navigation button that creates new records in Table B that relate to the same record in Table A. Thoughts/suggestions?
Table A fields: ID_TableA (pk - autonumber), name (text), id (numeric)
Table B fields: ID_TableB (pk - autonumber), ID_TableA (numeric), info (text), id2 (numeric)

Related

How to create encoded primary key for table from two different table primary keys

I have two table Table 1 and Table 2 now I have to create thrid table whose primary key is encoded and combination of table1 and table 2 pk's. I also want to fetch the record of table3 with table 1 and table 2 on the basis of table 3 pk.
can some one help me.
solution in my mind was if I can create some thing similar to JWT toke from the table 1 and table 2 pk's and store it in table 3 pk. but the problems is how I will decode it and perform basic CRUD operation with join query between different tables

Is it possible, when i save a data in postgresql table, automatically, id of record save in another table without trigger

I have 2 tables. First table is called Person. Second table is called PersonRule. Person table has much columns. But PersonRule has just 2 columns. In the person table, there is a column called ruleid. The column at the same time, there is in the PersonRule table. Is it possible, when i insert to data Person table, i want to automatically create a record in PersonRule table without trigger.?
And in PostgreSQL how can i do this.?

(PostgreSQL) Table A tied to multiple entries in Table B, Need to Sum the number in a column of each Table B entry

I'm working on a SQL project and I'm a bit stuck trying to pull a specific piece of data.
Table A contains a_id (primary ID), and a_name, while table B contains b_id (primary ID), b_name, and b_sales. A third table contains a_id, and b_id.
In this example, there are multiple entries in table B for each entry in Table A, I want to sum b_sales for each entry in Table A.
So if a Table A entry is tied to 2 entries in Table B, each with b_sales of 5 for example, I want to show that A Entry has having 10 total b_sales.

Using Entity Framework 6 to delete from a junction table but leave the record in the lookup table

I have 2 tables, 1 main table, 1 junction table and 1 lookup table. It's a 1-to-many-to-1 relationship. I'm looking for a way to delete all the entries from the junction table only, without removing the lookup value.
An example of my tables are below
Record table
id
name
Junction table
recordid
lookupid
Lookups table
lookupid
lookupname
Currently I'm passing in an updated model and I'm trying to delete all the junction records before reading the new chosen values. So far everything I've tried deletes out the record from the lookup table as well.
foreach (var lookup in recordFromDB.Lookups.ToList()) {
_context.Lookups.Remove(DesignSoftware);
}
Try this - just using the .Clear() method on the navigation property should remove any navigation (a.k.a. "junction") entries - but not the actual Lookups entries:
recordFromDB.Lookups.Clear();
YourContext.SaveChanges();

Create drop down list to populate foreign key fields

i am new to oracle 10g. I am using it to build some forms. I have created all the tables in sql+ and i have designed my forms. I am having a problem with the foreign key fields in the form.
I have a table named class, class has 4 foreign keys which are represented on the class form
R_ID which is the primary key of a table called ROOM
E_ID which the primary key of a table called EXAM
T_ID which is the primary key of a table called TERM
SUB_ID which is the primary key of a table called SUBJECT
In the class form i want the user to be able to create or update a record of a class. For user friendliness i want when they put the cursor on any one of the foreign key field to enter its value, I want the corresponding NAME from the parent table to be displayed as a drop down list instead/as well as the numerical foreign key value. The user's choice would populate the foreign key field of the class table so
IF R_ID = RM001 and the name of that room in the parent table is Chemistry LAB. I want the user to see chemistry lab and choose that but it populates the class table in the database as RM001
I have created all my navigation manually via buttons, this is the last thing i have to do and im stumped. I want the user to be able to click the field and the drop down list automatically appears.
Any ideas? thanks very much
Found the answer for people you are seeking this information
Use the list of values (lov) wizard.
Build query in the wizard by selecting the attributes of the table you want( the parent table of the foreign key)
Set the return value as the foreign key in the child table
Assign a button to execute the lov created
This works