Don't know how to merely google for an answer on this one: How does one go about constructing an ever-expanding per-date engagement timetable - that links an employee and work type to a specific date?
What I want to achieve:
("RW" and "DO" is supposed to be user input stored in "tblEmployeeEngagement")
This is pretty easy to do with excel's tables, and index and match functions can do wonders, but I don't know how to get user-friendly results in access. Here's my table construction:
tblEmployees
EmployeeID (autoincrement)
First Name
Last Name
...
tblWorkType
WorkTypeID (autoincrement)
ShortName (text, unique)
Description
ShiftStart
ShiftEnd
...
tblDate
DateID (autoincrement)
Date (date, unique)
CompanyOperational (bool)
...
tblEmployeeEngagement
EngagementID
EmployeeID (relationship with above)
DateID (relationship with above)
WorkTypeID (relationship with above)
Let's say these are the tables. Theoretically one can enter multiple Engagements for same person with same date, but this is not at all necessary and let's say this option is eliminated. How do I go about making editable query/table for easy input as the one in picture?
A crosstable constructs it exactly as I want it, but it is NOT editable (as in pic related), which is an issue.
I am open to completely removing "tblDate" and adding "Date" field in "tblEmployeeEngagement", but I still don't see how I would construct this sort of query/table without VBA. The desired result is for end-user to be able to populate "tblEmployeeEngagement" alone.
Help.
I would build a form that does not have a table behind it.
In the header I would have a typed header for Employee and then I would have 7 (or 10 or whatever) number of fields for the dates. Let's assume that you are putting in time in the past, VBA On Open could set the 1st label text to 7 days ago, 2nd to 6 days ago, 3rd to 5 days ago, etc. If you add a date that matches to your tbl and is non-working, simply lock and darken the fields underneath those dates.
Under employee label, I would have a drop-down to choose the employee. Next to that would be 7 fields which each have the choice of RW and DO.
The user would then select an employee from the drop-down and go across the days and set the dates to be RW or DO or blank depending on the status.
When the user clicks the Save (or Close or whatever ) button, the computer would then create records for each employee, each date, and each Engagement to the Engagement table.
If you want them able to edit these Engagements, you could bring in the data for each Employee during the date range given.
Hope this helps.
Related
Could someone help to understand the efficient way of storing the timesheet data (Timesheet_Details)?
The timesheet data can be input in multiple ways
Start time and end time (9am to 5 pm)
Plain input of hours (8 hours)
Input like hours in multiples of 2 (2,4,8)
Based on unit like e.g. 1 = full day, 0.5 = half day.
What I have is a master Timesheet table which will store the start and end date for the job. But I am confused how to store the timesheet hours against each date.
Timesheet
id
client_uuid
user_uuid
job_uuid
start_date
end_date
Timesheet_Details
id
timesheet_uuid (FK)
date
?
?
?
You say that the timesheet data can be input in multiple ways (the four mentioned). Is it something you need to have in the interface of the application? Is it something you really need to duplicate in the database? What I mean is that even though the user experience that is asked is to be able to enter the time in multiple different ways, it does not need to be stored this way, the data can be transformed in a way that is consistent in the database, and then you would show the format according to the user preferences. You would use some algorithm to transform the data and store it correctly in the database.
For instance, you could add a table that contains all the possible ways of showing the time, listing the four that you mentioned here but with codes, let's name it "time_presentation". The interface would show a dropdown and the user would select a way to enter the time. The interface would change according to what they want (for example, two inputs to enter beginning and end, one input to enter only the hours, etc.). Then, the data would be sent to the backend and stored in the Timesheet_Details table but always with the same format that you will have calculated with the code, for example, a float column containing the total hours, and a column containing a foreign key to the table "time_presentation". Then, to show the item in the interface, you would be able to use both columns and reverse the process to show it according to what the user entered and how they entered it (if it's important the user sees it as entered).
If it's absolutly necessary to store the data directly with the 4 methods mentioned, then I would suggest using a varchar column with the value (but this would be a lot less easy to validate).
I'm completely new to creating MS Access databases, so please bear with me while I ask my (probably silly) question.
I have a table for commodities that also groups them into CropGroup and Class, and every commodity would also be considered 'Any food'.
Commodity table:
I would like to add one entry (maybe in a form?), with fields like 'Country' 'Commodity' 'Metal' 'Limit' with all fields identical other than the commodity. Rather than entering these manually for each commodity, is there a way that I can specify the country, metal and limit, select 'Fruit' or 'Anyfood' to automatically create a record for each commodity associated with these terms, so it looks similar to this? Doing this would save me hours if not days of work in the long term.
Output table:
Any suggestions or pointers in the right directions would be much appreciated!
Cheers,
Sophie
You can set default value for text or comboboxes in data entry form.
So, you will set default value for each text box individually. When you you will run the form, text boxes will fill with default values automatically. If need you can then change values as per your need. As per my above screenshot, when you run the data entry form it will look like-
If anyone comes across to this question later, I was able to solve this perfectly with a relatively simple SQL query in the end:
INSERT INTO MetalLimits ( Country, Commodity, Element, [Limit(mg/kg)] )
SELECT Country, Commodity, Element, [Limit(mg/kg)]
FROM (SELECT Commodity FROM _CommodityList
WHERE (([_CommodityList].CropGroup) Like [Enter CropGroup] & "*") AND
(([_CommodityList].Class) Like [Enter Class] & "*")) ;
This allows manually entering Country, Element and Limit(mg/kg) as per the table rules (for MetalLimits table) in separate prompt pop-ups, and select the commodities based on the pre-defined CropGroup and Class (from _CommodityList) in another pop-up.
I have got a form with 3 input fields (date, time, telephone) and I need to build a database where I can select date and time from drop down menu (two separate tables where one has got date values another one has got time values).
Both of these date and time tables have another column with value 0 or 1. If this value is 0 you can select that time, but if the value is 1 it can't: e.g. I select the date and it shows me available times, so then I can add a telephone number and submit all values to another table (date, time, telephone I guess) - but if the time is already taken it can't be selected.
If all time slots are selected already you can't select that date because the date value changes from 0 to 1.
It's my first database project so I don't really understand things in database architecture yet. I don't need the code I'll figure it out, I just need to see how the database looks with all the tables, primary keys etc.
I am working with Access2013 and I have a query called PaidOrderQ with columns "SalesRep", "Customer" and "PaidAmount". I need to calculate the SalesRep's commission which isn't always the same percentage for each record. After reading through similar questions here I still haven't figured it out yet.
The way I thought doing it is to have a form called PaidOrderF with soucre is PaidOrderQ, a textbox called "CommRate" and a calculated field "Commission". The "Commission" gets calculated by "AmountPaid"*"CommRate".
I'm not sure how the percentage for commission is calculated, but there are a few ways this can be done depending on how the percentage is calculated. The first would be if you can calculate the percentage that will be used automatically. Then you can add everything automatically (even if the percentage changes based on the item). If this is possible you can open the query up in DESIGN view. Then click onto a blank field and you can make a calculated field for example:
Commission: [AmountPaid]*[CommRate]
Now you can add the calculation for CommRate for example:
CommRate: IIf([AmountPaid]>200,.15,.2)
Which would make any the comm rate 15% over $200 and 20% under.
If not you can make Text boxes in a form (which would be unbound and add an after update vba code to multiply them together and change the value of a third text box, label etc.)
You may also want to add a column to the original table to show commission rate so the information would be stored for future reference.
Let me know if anything is unclear or you would like to see an example of the vba code
EDIT::
Storing information to a table:
This one will be very basic and you probably know most of this, but just in case I will include it because it is the most straight forward.
Add a column to the table you are working from by opening up the table in Design view (you can also make a temporary table by using a make table query if you are using a liked table or do not want to modify the structure, but it is better to put it in the main table if possible). Here you could make a query that includes all of the fields plus the additional calculated field that shows amount paid * commission. Then when you make a form based on the query you will enter in the commission rate and the form will both save the information and automatically update the field to give commission.
Linking another table by Primary ID -
If neither of those options work you could also create another table that shares a primary ID. This option will be more complicated, but is possible. (I would recommend not making it a true primary ID for the second table so it is easier to modify (Or have a true primary ID and the ID you will use to link ie. 3 total columns)). If this is the option you need I can go into more depth, but the disadvantage of this method is if there is no CommRate listed for a given record it will automatically hide the information (it is possible to avoid this, but again will be more complicated) so it will be easy to make a mistake.
VBA coding
VBA will be the most complicated solution, and has the largest disadvantages. First - You will have to loop all of the records at one time (or at least for one employee) and when you close the form you will lose everything. If there is any way to avoid this I would suggest doing so, but you could theoretically store the information in an array.
The Standard Way -
As I understand it your table looks like this:
SalesRep Customer PaidAmount
John Eric 2040
Stacy Brian 1020
Stacy Eric 2004
etc.
You will want to open up your table in Design view and add a column "CommRate"
so it will look like:
SalesRep Customer PaidAmount CommRate
John Eric 2040
Stacy Brian 1020
Stacy Eric 2004
etc.
The data type for CommRate should be Number - type Double - Now I would use Comm rate as a percentage - ie 10.2 = 10.2%, but you could also do .102 = 10.2% either one is fine (more on that later) save and close the table.
Now with the table selected use the create query wizard add all of the fields to the query, give the query a name and click modify the query at the end (or save it then open it up in design view). Now you will see each field in a column with the table listed below. Copy and paste the entry below to your query in one of the bank "field" locations:
for percentage ie 10.2=10.2%
Commission: [CommRate]*[PaidAmount]/100
for .102 = 10.2%
Commission: [CommRate]*[PaidAmount]
Now save and close the query.
Lastly you will select the query then click on create form. This will make a form based on the query. With this form you can add the CommRate individually and it will be saved for the future. You will see that when you add the CommRate the Commission field will automatically update and the table will get updated with the new value.
This is the standard way of doing this. Does this work for what you are doing?
Alright well that is good news! The primary key will help a lot:
Ok here is how you can solve this with two tables.
First create a new table with three columns:
"ID" - Primary Key "RelatedID" - Number Long Int "CommRate" - Number Double
This table will basically just be used to "add on" the CommRate without changing the linked table.
Next you will make a query that includes "SalesRep", "Customer" and "PaidAmount" from the linked table AND the "RelatedID" and "CommRate" from the new table.
When you view the query in design view you will see both tables above the list of the different fields and you will click on the primary key from the linked table and drag it to the "ReatedID" in the new table. From here it will open up a dialog asking about the relationship join. This part is the most important - You want to make the relationship a LEFT JOIN - You do this by saying you want to show ALL records from the Linked table and only the record from the New table that match. Basically this makes it so it will always show the records from the new table even if there is no entry that matches in the new table.
After you have that created you will just make a calculated field as before by copying:
Commission: [CommRate]*[PaidAmount]/100
to a new field on the query design
From here everything is set up and you can create a form based on the query you just made - I would delete the field "RelatedID" from the FORM (or the Query the relationship is what links it so its not necessary it is just a good double check) so you don't change it.
How it works - Now when you cycle through the entries you can add the commission rate directly to the form. - This will make a new entry in your new table that shows the primary ID of the transaction and the commission rate for that sale. This will update the calculated field and show you the commission. Then when you view it it will save the values individually without changing your original table.
Keep me posted if you need more help on how to do this. It can be a little tricky the first time you do it.
I want to make an excel graphic with 3 values:
Sales Order Date (The date sales enters the sales order)
Requirement Date (The date the customer wants this order)
Closed Sales Order Date (When sales closes the order)
This will be used to measure the service of our plant against completed delivered sales orders monthly.
I already found the first 2 data cells on table VBMTV, anyone has an idea where can I get the information regarding as the date sales close the order once it has been delivered to the customer?
Regards,
Assuming that the data is displayed in a transaction, you can do the following:
position the cursor in the field you are interested in
press F1 - you get a help text in a dialog labeled 'Performance Assistant'
click the button for 'Technical Information' (looks like a hammer and wrench) - you'll get another dialog
in this dialog there are fields for 'Table Name' and 'Field Name'
For most transactions, this information maps to the specific tables/columns in the database. There are some exceptions to this rule (mostly for those cases where the data is not directly read from the db), but it is a good start and works for about 80% of the cases.
If F1 and Technical Information (F4) does not work you can also try running a trace using ST05. (Do this only for one user and make sure to disable the trace once you are done).
I believe Sales Order Complete may be a status. (TECO or "Technically Complete" if I'm correct). The table that stores the date a specific status was set is JCDS. You will have to read it on the OBJNR of the sales order and the internal status number of the status that you care about.