Linked forms won't update data in table - ms-access

I made linked forms to input data into a table called t_Transactions. These forms contain data from 3 tables. Those tables are:
t_Group: consists of group number (primary key) and group name
t_Member: consists of group number (foreign key), member number (primary key) and member name
t_Transactions: consists of transaction number (primary key), group number (foreign key), member number (foreign key), debit transaction, and credit transaction.
The first form (let's call it form A) contains data from the t_Group table. A second form (let's call it form B) is linked to Form A, and it contains data from the t_Member table, and a subform containing data from t_transaction. The subform only has 3 fields: transaction number, debit transaction, and credit transaction. (See picture 1 Picture 1 and Picture 2 for form pictures)
Now when I input the "transaction number", "debit transaction" and "credit transaction" fields in the t_transaction subform in Form B, all of the fields in the t_transaction table are automatically filled, but the group number field is left blank, like this. I want the group number field to be filled with data corresponding to Form A. How can I do this? I checked all my relationships, and it is correct.
Any help will be greatly appreciated.

Related

How can I avoid duplicate records with autonumber ID and how to increment autonumber ID sequentially in access?

I have an input table (including input ID and Input fields) and a type table (including typeID and type fields) where there is one to many relationship between them (one type ID to many inputs)... InputID and typeID are the primary keys and autonumbers. I have a data entry form where the user can select input from a combo box and then the correspodning type from another combo box. Every time I enter a new input and select a type ( from the existing types in the type combo box), I have a duplicated type in the type table as typeID is an autonumber (duplicate types). My first question is that how can I avoid generating duplicated records for type when user chooses from one of those existing types by keeping the typeID as an autonumber?
another question is that why autonumber filed doesn't increase sequentially when I add a new record from the form to the table? for example even if I had deleted some records seems like it has those IDs in the memory and increment from there not from the last existing ID in the table. I was trying to use compact and repair option but didn't work.
I aprpeciate your time and help in advance.

ms access how to use only one column in a combobox to set the value of a field in a table?

I have two tables - 'Customers' and 'Items' which are connected by one to many relationship ('CustomerID' field (primary key) in 'Customers' table is related to many 'CustomerID's in 'Items').
I also have a form for Items table. In this form, i have a combobox with two columns - names of the customer and the customerIDs (both from Customers table). When the user chooses an option i want to insert only the CustomerID in the 'Items' table.
Thank you in advance.

MS Access Creating a New Order And Orderline

I have a Customer table, an Order table, an Orderline table and a Product table. All of them have an Autonumber field as their primary key, and Orderline has a foreign key reference to Order ID on Order table:
ORDER
-----
Order ID - Autonumber
Customer ID - Number
...
ORDERLINE
---------
OrderLine ID - Autonumber
Order ID - FK to Order
Product ID - FK to Product
Quantity
PRODUCT
-------
Product ID - Autonumber
Product details...
I have a form where I can choose a customer, and then a list of records from the Orderline table, and a query which I reference from this sub-form which lists the Order ID, Orderline ID, Product ID, Product details...
I have 2 problems.
All the orders appear, and I only want the ones associated with this order, (which should be none when the form first loads).
When I enter a Product ID that I want to add to a new order, I am expecting a new Order ID to appear, (Autoincremented) AND a new Orderline ID, (Autoincremented) and the details of the product that I have selected, corresponding to theProduct ID` I have entered, but instead I get this error message:
The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again
The thing is, the tables should create me unique keys when I try to create the new record, and when I go into each table directly and enter a new record, the autonumber does work and does create a unique key - it is just when it is trying to create both the Order ID and the Orderline ID at the same time that it seems to be failing.
I should say, I have spent days on this, searched countless search engines, watched whole series of YouTube videos on creating Order forms but to no avail. Anyone who understands Access I am sure would be able to help me, as I would be able to help anyone in a similar circumstance in a matter of minutes if this was a problem in SQL.
When you create a sub-form you have to specify the relationship between the parent and sub-form. the same relationship you have created for your tables. Then only Access will filter the records for you.
Regarding your question. You should create a new [order] record in [order] table where you will be entering/selecting [customer_id, staff_id, order details ect]
one order can have more than one items so your [order_items] table (i assume orderline is the term you use for this table) exists of
order_id
product_id (order_id, product_id composite key)
quantity
price
etc..
Now when you want to start taking order you need to create a new form that is bound to tbl_order. In the frm_order you will have a sub-from which is bound to tbl_oder_items (in your case orderline)
The frm_order and frm_oder_items should be have a relationship. usually when you drag the table to create the subform ACCESS will ask to set the relationship. if you create the subform manually:
Select the sub-form
go to property sheet
select the link master field : order_id
select the link child field : order_id
Now when you open the frm_order it will show all the records (in other words all the products the order has in its list) from the tbl_order_items table.
Your tbl_order_item /orderline table also referencing to the product table via the product_id field.
Insert a combobox in the frm_order_items and bound it to the product_id. The combobox's rowsource would be
select product_id, product_name from tbl_product
This error message will occur:
'The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again'
when you try to add a product twice for the same order. instead you should increase the quantity for the product.
Try this and let us know how it went.

How to create form that contain data from 2 tables and save data to one table

i have 2 tables:
Employee:
ID
SalaryPerDay
Name (unique)
.....
.....
Schedule:
ID
EmployeeID
Date
Attending (boolean)
loan
discount
overTimeHours
and a query
EmployeeNameQuery: that return all employees names
i create a datasheet contains
column 1: employees names (EmployeeNameQuery)
column 2: Date (Schedule)
column 3: Attening (Schedule)
column 1: OverTimeHours (Schedule)
column 4: Loan (Schedule)
column 5: Discount (Schedule)
this data sheet display rows as employees names count
Questions:
1- Decimal number display as (280) how can i display them as (280.00) i can insert decimal number but i display values with .00 without .00
2- How to create form that contain data from 2 tables and save data to one table,
when i fill all datasheet with attending i want to submit these information to Schedule Table with each field with related one in the table and insert EmployeeID of selected employeeName.
In regard to both one and two, it seems that you have not bound your form to a table or query. Datasheets and continuous forms only work properly if all the data-entry controls are bound to fields. It is nearly always best to use a continuous form rather than a datasheet. If you are not familiar with form design, it is nearly always best to use the wizards, because they will set up the form with all the bindings in place.
For currency, choose the currency data type, not decimal - this is important for more than display. In addition, fields have a format property that can be set in table design.
I suggest you do some reading if you intend to continue to work in Access. You will find lists of books here on Stackoverflow - The Access Cookbook Getz, Litwin and Baron is often recommended.

How to add a checkbox in a form next to a query to append to another table

I am building a training database.The tables I am using are: Employees, Training Courses, In Training, and Completed Training. I have a query that filters off of a form to show employees that have not received the training.
I want to add a checkbox next to the results so I can select some or all of them to be added to the In Training table. I have been stuck on this for days searching the internet and reading books looking for the answer.
Just saw this question. Here is an alternative solution to this problem. There is no checkbox, but you get a subform with combo box to update the course and progress for a particular employee.
Create 4 tables with the fields:
tblEmployees
EmployeeID (Primary Key)
EmployeeName (and any additional fields you might need)
tblProgress -> this stores "IN TRAINING", "COMPLETED" as 2 separate records
ID (AutoNumber) (Primary Key)
ProgressDesc
tblTrainingCourses
CourseID (Primary Key)
CourseName
tblEmployeeTraining -> here we are using composite key
EmployeeID (Primary Key)
CourseID (Primary Key)
Progress
Create a one-to-many relationship between tblEmployees and tblEmployeeTraining, linking the EmployeeID.
Configure the following fields in tblEmployeeTraining (in Design View), by selecting the [Lookup Wizard...] from Data Type column.
CourseID
Choose the tblTrainingCourses as the table for the Lookup Values
Progress
Choose the tblProgressas as the table for the Lookup Values
Create a Form based on the tblEmployees. You should get a subform included that will display the Course Name and Progress. Basically, the 2 columns in the subform will show combo box for you to select the course and the progress.
If you do not want the relationship in step 2, maybe you want to store the employee data after it is deleted, then you need to create a query and use it as the RecordSource for the subform. Instead of deleting the record from tblEmployees, you may want to add a field in tblEmployees to determine if the employee is active or not. Then, you can use the above steps and just do filtering on the form to display those active employees.