Newbie needs help incorporating recurring tasks into MS Access database - ms-access

I am a complete novice to programming and the little I know is self taught from 10 years ago. I have created/am creating a database to track productivity for my team at my new job. I have based it around the "task manager" template within MS access. The major functionality that I require is to be able to enter in tasks which are recurring at varied intervals. Ideally, I would like the future dates for tasks to self populate the 'tasks' table in advance, or even better, as an a team member enters in the completion info for their current task, to have the next entry then entered into the table. When team member pulls up their 'future tasks' or even 'daily tasks', they would see future entries listed automatically and not have to go in and enter each recurring report individually. Currently, new tasks are entered using a blank version of the 'task details' form and tasks can be edited using a button which brings up the corresponding task on the 'task detail' form, but it edit mode, so completion information can be entered or status changed, but there is no option to make a task recurring and have the information for future dates automatically entered for the team member.
I have downloaded Allen Browne's recur database and its good, but falls short of what I need- or rather - my knowledge base is falling short on how to incorporate it into what I have built. There is no 'table' that houses all the recurring events in his db. He uses a query and I am unsure how to 'connect' it to the task manager form/table. I have a table in my db called 'tasks' which connects to the 'task manager' form and the 'task details' subform - all part of the template that comes with access. I have tried to 'connect' everything, but because its query based, its not updating the 'tasks' table and since you cannot have a form based on more than one table/query, I cannot even get the future dates to come up in the 'task management' form or 'task detail' form either. I tried adding the fields from the recur DB to my tasks table, and again- its beyond my abilities - nothing I have tried with my limited knowledge is working.
If anyone can please help me in anyway to figure out a way to connect them both so it all functions- I would be most appreciative!
Thank you,
Debbie

Related

Can I generate multiple new records based on value in another table, in MS Access 2013?

I'll qualify this with the upfront admission that I am not a professional programmer or database designer. I had a specific problem to solve - the need to manage a great deal of information on employee benefit requests - and limited resources, and built a database to replace the Excel spreadsheet I inherited. I'm learning as I go, and what I'd really like to find out is, can Access do what I'm envisioning, or do I need to adjust my goal?
The main tables my database includes are EMPLOYEES, REQUESTS, TASKS, and ACTIVITY (plus some auxiliary tables used for drop-down fields, etc.). Each employee can have multiple requests, and for each request, I used TASKS to keep track of all that needs to be done, by whom and by when, to see the request through from start to finish (I'm the only user of the dbase file itself, but I publish the task list as a report to those involved). ACTIVITY, as you would expect, is the "journaling" feature where I keep track of what's been done, conversations, etc.
What I want to do now is speed up the process of task entry, since for MOST requests, the taskflow is pretty similar. I already created tables for "TASK OWNER" and "TASK CATEGORIES" - both related to my primary TASKS table - so I could standardize the data entry for those fields, in addition to filtering on it ("show me everything the employee owns"). TASKS has a "NOTES" field so I can individualize the entry without changing the drop-downs. It's progress, but I'm still spending too much time adding the same however-many tasks to each new request I set up.
What I've been playing with in my head is identifying tasks with some sort of code that associates them with a type of request - i.e., an employee request for tuition reimbursement is identified as "request type 001" and all the tasks that normally go with a tuition reimbursement have a lookup field connecting them back to "001" - so that when I check a box or select "001 - Tuition Reimbursement" from a drop-down on my form, the 6 or 8 "standard" tasks automatically drop in to the TASKS subform, BUT they're NEW records - not just "template tasks" that I'm querying from my TASK CATEGORIES. I want to be able to tweak, edit, update, and even delete them, without affecting any other request.
I've found a lot of information adding new records via APPEND queries, but it seems to be limited to generating ONE record for each "transaction" if that makes sense - each time the query finds its value and performs the action, one record is generated. How do I get Access to recognize one value - request type - and generate each of the tasks associated with that request type as a new record in TASKS?
User selects category of request, such as 'Tuition Reimbursement' from a multi-column combobox. Hidden column of combobox has the category code and this is the bound column so this is value of combobox. Then code to save multiple records would be like:
CurrentDb.Execute "INSERT INTO Tasks(RequestID, TaskDesc) SELECT " & _
Me.tbxReqID & " AS RID, TaskDesc FROM TasksCategories WHERE TaskCat = " & Me.cbxCategory
The real trick is figuring out what event to put this code into. Should it be automatic after some data element is entered or should it be a button click? Then there is need to prevent duplicate entries - what if user accidentally clicks that button again? (This might be handled by a compound index setting in table.) Also, the new master record created on requests form has to be committed to table first. Record is committed when closing table/query/form, moving to another record, or running command to save.
As shown, your requirement is certainly possible, just keep in mind "the more user-friendly, the more code".
Now, when you develop code with specific issue, post it for analysis.

Filtering dates in Access queries?

I'm building a report for a client. The report is not very complicated, just shows a bunch of stuff requested by the clients. One of the things I'm stuck on is... I need to be able to search by Transaction that took place between today and 6 months back. So when user click on Transaction report, it only shows the last 6 months from today. Anyone have any idea? I'm trying to build a query with that criteria, but I have no idea how it should be.
Another part of the report lets the client choose dates for the report (FROM & TO) and that's not too bad because I'm passing these values to a blank form and then using them in the report. However, here I'm having a hard time figuring it out.
=DateAdd("m", -6, Date()) This fulfills the requirements in my application

How Do I Make a Subform Controlled by Report (Which is Controlled by a Query) Update After Records Are Added?

I recently took a duty position that requires me to track our administrative actions. Previously, the office had tracked them on an Excel spreadsheet, and the historical data was corrupted/missing. So I have built a database in Access 2010. I designed the database to display a main form that provides an overview of each action, but decided to require most of the data to be added or updated on specific data entry forms. My question relates to two subforms on the main form that I cannot get to update after data is entered into the tables. Here are specifics:
1) The main form is the case detail form, and each case has a unique case ID number that links most of the forms and tables.
2) The Case Detail Form has two subforms. One displays the names of the people involved in the case (this is the Subject Subform). The other displays the case history entries (this is the Case History Subform).
3) Both of the subforms are supposed to work the same way. Each is populated by a report which displays the information in its corresponding Subform. In turn, the reports underlying each Subform are based on a query that selects the records to display based in the case number.
4) New data for the subforms cannot be entered on the Case Details Form. Instead, the user can press a command button which launches a separate form that allows the user to enter either subject details or to enter a case history update. Once the user enters the data, he or she clicks A Save Record button, which saves the record and closes the form window. Everything seems to work fine up to this point.
5) However, I've now been working on this project for two weeks (as time permits), and I am still not able to make the two subforms update automatically. If it's a new case record, the user can make the Subforms update by using the navigation arrows to leave the main Case Details Form and then returning to it. If it's an established case record, a refresh button that I have added to the main Case Details form will cause the two subforms to update.
As I've tried to make this work, I've tried a number of approaches that I've found on various boards. Right now, I have:
A) The Subject data entry form has a Me.Requery statement in After Insert Event Procedure
B) The Subject data entry form has a SaveRecord and a CloseWindow command that are executed when the Save Record Button On Click event is triggered.
C) The main Case Detail Form has a executes a Me.Case_Subjects.Form.Requery when the GotFocus Event Procedure is executed.
I apologize for the lengthy question and explanation. I'm an Army officer and a little out of my depth with this. I would greatly appreciate any help anyone might be able to offer.
Best regards!
I'm not sure having understood everything but I try to give you some suggestions about what to try.
If I'm not wrong both form and subforms have the case ID as field so when you created the report you should have put them in "link" by the wizard (you can set it manually after but it's a bit more tricky).
Did you do this? This makes the form / subforms update when you navigate them.
Please note that there must be a relation between the underlaying tables to guarantee that the reports / forms moves together!
This applies to the query too, just remember to include the ID field int the queries.
If you don't want to see the ID (in case you use an autonumbering id) you can set it Not Visible.
In case you don't want to link the two tables with a relation there is another solution but it's a bit more tricky and, if it's not your case, I don't want to make confusion.
Let me know if you solved.
Bye
Firstly, the line Me.Requery should be on the After Update event, not the After Insert event. Secondly, you will then need to change Me.Requery to Me.[insertsubformname].Requery.
As the user above said, you will need to ensure that you have created your database relationships properly, however if you used the Insert Subform, it should've asked you what you wish to use as your link between the forms.

Access 2010 update date field based on another field

I'm relatively new to Access and VBA but I have managed to get some basic VBA tricks working in both Access and Excel. Now I've got a challenge that I can't seem to crack. I'm building a database to track maintenance of a small trucking fleet. I've got most of the tables and forms I need to do the basic tracking and management of equipment and maintenance in place.
One of the things we're tracking is called PM's which stands for preventative maintenance (lube jobs and oil changes). We do those on calendar intervals for trailers and mileage intervals for tractors. Right now, I'm trying to get the calendar tracked equipment working. I've a table called tblEquipmentMaster which is where all the specifics for each piece of equipment is kept (make, model, year, VIN, etc) and that table has a field called LastPMDate. All the maintenance records go in two other tables, tblMaintenance which records the unit number, vendor, invoice date and invoice amount and tblMaintenanceDetails which records the each line item of work that was performed on the unit (i.e. replaced water pump, replaced headlight etc).
The maintenance details table also contains a drop down list of standard maintenance codes to allow for easier searching of certain maintenance items later. One of those codes is PM. I also have several forms built to interact with these tables including a data entry form for adding new maintenance records.
What I'm trying to accomplish is to have the LastPMDate field for any unit number in tblEquipmentMaster automatically update to match the InvoiceDate field in tblMaintenance anytime an invoice is entered for that unit number which has a line item containing the code PM.
I've tried building an update query to do this but in addition to changing the LastPMDate field like I want it to, it also ends up changing the invoice dates for all previous PM invoices to the date of the last invoice which contained a PM. Not good.
So my question is, would an update query be the best way to do this or would I be better off with some sort of VBA solution? I have an add record button on my maintenance invoice data entry form which users use as a save record/clear form button when all the info for an invoice has been entered. I'm thinking some VBA code tied to the on_click of that button which would look at the invoice you just added, determine if it contains the PM maintenance code, then update LastPMDate field for that unit number with invoice date from that invoice would be a good way to do it but I honestly have no idea what functions or methods I'd need to get that to work.
Any insights or suggestions appreciated.
It's very hard to follow the flow of what you are describing, even if I have experience of PM and AM (Autonomous maintenance).
What is lacking is the relations between the three tables.
Nevertheless I prefer VBA solutions (maybe because I started programming when everything had to be written...). With VBA you can finely control your workflow.
If I understood well the 1st table is tblMaintenance in which you have the Invoice data.
Then you should have to scan the tblMaintenanceDetails to find the list of PMs and filter the tblEquipmentMaster with current PM value to update the LastPMDate with the date of the 1st table.
Did I succeed in providing you an idea to solve your problem?
Let me know.

Access Web Application Data Macro to Sum values in Query and return as variable

I am working on a small application in Access Services on SharePoint to log colleagues leave requests, and I need to work out a data macro to calculate how many days of leave they have remaining from their allowance.
I have a table [Colleagues] with all of the user data, for simplicity I'll reduce it to [Email] and [Allowance] in days. I have another table which stores the requests [Requests] including the number of days to deduct in each approved leave request [Days Requested].
I have set up a query that returns all approved requests for the colleague and I would like to use a data macro that is triggered to run when the colleague logs in. As you cannot use aggregate functions in Web Applications, I am currently using ForEachRecord in the query to total the number of deductible days, however I cannot work out how to return that to a field in the [Colleague] record.
According to the Access help, I should be able to set the value to a LocalVar and use it in expressions as simply as referencing [Deductible Days], however this is not working.
Any help?
I finally worked this out after much tinkering.
In my query I included the [Colleague Email] field as well as the [Days Requested] field, and then when my Application loads it navigates to a form created from the [Colleagues] table. I have modified the Data Source of the form to link the [Email] field in the query results to the [Email] field in the [Colleagues] form.
Following this I was able to create an unbound textbox with the data source =Sum([Days Requested]) referring to the relevant field in the query. Voila! I now have the value to play around with in my application.
Hope that helps, took a lot of fiddling around. No data macros needed after all, but its a method I shall remember in future, opens up a lot of possibilities.
If I understand your situation correctly, I was faced with a very similar problem.
I believe the solution used here will work for you. It involves using a query to Sum up the values (we would use Sum where he used Count), use a Data Macro to run the query and then have have an On Insert/On Update trigger the Data Macro:
http://devspoint.wordpress.com/2014/03/26/validating-data-with-data-macros-in-access-services-2013/
Let me know if this works for you. It worked for me!