I have a table with order data. This consists of OrderID, OrderNo and FCode. How can I get all orders associated with a selected FCode. So the outcome must be the FCode selected plus the other orders with the same OrderID. As per attachment, if I select AB as FCode, it must be bring back all the ones highlighted(yellow and gray)
Orders Info
I am new to Quicksight...tried using filters with parameters but it only bring back the selected FCode :(
Related
I have a form showing Customers. Now I would like to also display all Orders that the currently open customer has made.
The Order table has a foreign key to Customer.
I have tried using a list box with Multi Select set to Simple, but somehow it shows me all Orders instead of just the ones of the current customer.
More Details:
My list box has
Control Source: ID
Row Source: SELECT customer.id, order.info FROM customer
INNER JOIN order ON customer.ID = order.customer_id
If I set the Multi Select to None it always marks the first Order that matches the current customer, but not all matching orders.
Can someone point me in the right direction?
Thank you.
P.S. I don't necessarily want the list to be functional for the creation of a new Customer. If it would also work then that's a bonus.
Assuming your form is bound to Customers table, then you need to add code to the form's Current event:
lstOrders.RowSource = "SELECT id, info FROM order WHERE customer_id = " & Me.id
lstOrders.Requery
The list box (called lstOrders) should have its column count set to 2. If you don't want to see the order.id column then set the "Column widths" property to 0 (this will set the width of the first column to 0 and let the second column, order.info, fill the remaining width of the list). Set the "Bound column" to 1 - this means that the "value" of the list box will be the order.id
I have a Form name frmCEA1 and a Table named tabsubCEA. Field names are:
E_ID (which is Employee ID, number field)
FY (which is Financial Year, String i.e. 2014-15)
FChildPrFr ( Which is Claim start Date, Date ( dd-mmm-yy format))
FChildPrupto ( Which is Claim end Date, Date(dd-mmm-yy format))
There are also
four fields in table (tabSubCEA)
EID (which is Employee ID, number field),
FY (which is Financial Year, String i.e. 2014-15),
PeriodFrom ( Which is Claim start Date, Date ( dd-mmm-yy format)),
Periodtill ( Which is Claim end Date, Date(dd-mmm-yy format)).
An employee can process claim single times in a financial Year for single child and he/she can claim for maximum two child. He/She can claim separate for both child or can claim as combined. He/She can also claim for previous financial Year.
I processed claim for an employee for single child in Fin.Year 2014-15 now employee is going to claim his/her second child for same financial year and I processed it successfully.
I want to know that How can my form(frmCEA1) prevent me using (messagebox) if i goes to process claim for same information i.e. same E_ID, First or Second Child with same claim between starting and ending Period.
I tried so much but could not success. Kindly help...
This doesn't necessarily have to be done in VBA, but that is an option. Either way, a query needs to be run to extract the number of records that match a given situation.
When an employee is being processed, run a query against that employee ID within your tabSubCEA table to find the number of records that exist for the desired financial year. However, instead of returning the actual record data, just return the COUNT of the records. If I'm understanding your situation correctly, whenever the COUNT exceeds two, then you don't want to process the employee. The easiest way would be to disable whatever "submit" button on the form.
Your query, whether a created query that references fields on the form, or via VBA would look something like this:
SELECT
COUNT(*)
FROM
tabSubCEA
WHERE
EID = '<employee id here>' AND
FY = '<fiscal year here>' AND
PeriodFrom > '<application date here>' AND
Periodtill > '<application date here>'
This will count the number of records that the employee in question has successfully filed during the desired fiscal year with an active claim period.
Basically, what you're trying to extract from the system is a count of the number of records that meet a specific criteria to this situation. You're going to want something similar to this to validate the number of claims an employee is making.
I am working on an employee management/reward system and need to be able to show a single "transaction history" page that shows in chronological order the different events that the employee has experienced in one list. (Sort of like how in facebook you can goto your history/action section and see a chronological list of all the stuff that you have done and affects you, even though they are unrelated to eachother and just have you as a common user)
I have different tables for the different events, each table has an employee_id key and an "occured" timestamp, some table examples:
bonuses
customers
raise
complaints
feedback
So whenever an event occurs (ie a new customer is assigned to the employee, or the employee gets a complaint or raise) a new row is added to the appropriate table with the employee ID it affects and a timestamp of when it occured.
I need a single query to pull all records (upto 50 for example) that include the employee and return a history view of that employee. The field names are different in each table (ie the bonus includes an amount with a note, the customer includes customer info etc).
I need the output to be a summary view using column names such as:
event_type = (new customer, bonus, feedback etc)
date
title (a brief worded title of the type of event, specified in sql based on the table its referencing)
description (verbiage about the action, such as if its event_type bonus display the bonus amount here, if its a complain show the first 50 characters of the complaint message or the ID of the user that filed the complaint from the complaints table. All done in SQL using if statements and building the value of this field output based on which table it comes from. Such as if its from the customers table IF current_table=customers description='A customer was assigned to you by'.customers.assigner_id).
Ideally,
Is there any way to do this?
Another option I have considered, is I could do 5-6 different queries pulling the records each from their own table, then use a mysql command to "mesh/interleave" the results from all the queries into one list by chronological order. That would be acceptable too
You could use a UNION query to merge all the information together and use the ORDER BY clause to order the actions chronologically. Each query must have the same number of fields. Your ORDER BY clause should be last.
The examples below assume you have a field called customer_name in the customers table and bonus_amount in the bonuses table.
It would look something like this:
SELECT 'New Customer' as event_type, date,
'New customer was assigned' as title,
CONCAT('New Customer: ', customer_name, ' was assigned') as description
FROM customers
WHERE employee_id = 1
UNION
SELECT 'Bonus' as event_type, date,
'Received a bonue' as title,
CONCAT('Received a bonus of $', FORMAT(bonus_amount, 2), '.') as description
FROM bonuses
WHERE employee_id = 1
UNION
...
ORDER BY date DESC;
I have a combo box which has 3 pieces of information
COMBO BOX 210: Materials ID, Name of Product, Cost, Description
After I update the combo box the cost figure is stored in another field in the table, so far so good, so in selecting "Apples" the cost "$1" stores.
Now, what I want to is have a different field where the description of the apple (the text) is stored yet I only update the combo box once, in other words after updating the combo box Field 1 stores the price and Field 2 the description of the apple.
I will offer you a different example which I hope is similar to what you're asking.
My form includes a combo named cboNames. This is the query for its row source:
SELECT f.id, f.fname, f.date_added
FROM food_test AS f
ORDER BY f.fname, f.date_added;
In the combo's After Update event I can access the values of those 3 columns in the selected combo row by referring to the Column index. Notice the column index numbering starts with zero.
Private Sub cboNames_AfterUpdate()
Debug.Print Me.cboNames.Column(0)
Debug.Print Me.cboNames.Column(1)
Debug.Print Me.cboNames.Column(2)
End Sub
So if I wanted to put the date_added value into another data control, I could add this to the combo's After Update event.
Me.SomeOtherControl = Me.cboNames.Colummn(2)
However I wouldn't actually store both id and date_added in a row of another table. In my food table, each id is associated with a unique combination of fname and date_added. So I would store only the id, and use a SELECT with a JOIN to the food table to look up the associated fname and date_added values whenever I needed them.
Is it possible to build an unmatched data query using two tables with a tracking a unique value field and also another value in the row as well (that value will not be unique).
For example I want to track a unique customer code from an invoice on a new table, compared to last month's invoice. The non unique value would be a "product code" of what they purchased.
A customer code could appear multiple times depending on if they have purchased multiple product codes.
Any help is much appreciated.
This should do what you want:
SELECT Invoice.CustomerID
FROM Invoice LEFT JOIN PreviousInvoices
ON (Invoice.Product = PreviousInvoices.Product)
AND (Invoice.CustomerID = PreviousInvoices.CustomerID)
WHERE PreviousInvoices.Product Is Null