Updating Table with Interval visits based on other table's start and end date
I designed an MS Access app for our maintenance department to control the visit schedule. I have 2 main tables: Project data (Project name, no of visits, contract start date, end date, amount, etc...) PPM (no of visit, scheduled date of the visit and visit type) Currently we are adding the data on the new project in the first table, and then we are updating the second table with the dates Manual. e.g. if I have a project start on 01/01/2017 and it will end on 31/12/2017 and we have to conduct 4 visits (Quarterly). So we are updating the 2nd table as the following: Visit no 1 02/01/2017 Quarterly Visit Visit no 2 04/01/2017 Quarterly Visit Visit no 3 07/01/2017 Quarterly Visit Visit no 2 10/01/2017 Quarterly Visit This to be able to get a schedule report. The question is: can I have a way to fill the 2nd table (PPM) automatically based on start date and end date and no of visits of each contract?
Yes, requires VBA code. Something like this: Sub CreatePPM(dteStart As Date, dteEnd As Date, strType As String) Dim x As Integer, dteVisit As Date dteVisit = dteStart Select Case strType Case "Quarterly" 'code here Case "Daily" While dteVisit <= dteEnd CurrentDb.Execute "INSERT INTO PPM(VisitNo, VisitDate, VisitType) Values(" & x & ", #" & dteVisit & "#, 'Daily')" dteVisit = dteVisit + 1 Wend End Select End Sub Modify code as required to handle different visit types. I have to say coding for the Quarterly type does seem to be challenging. Then figure out what event to put the code into. Perhaps a button click or AfterUpdate event of Project data entry form. Will probably need additional code to make sure records are not entered multiple times. When you develop code and have specific issue, post question.
Access Month Calendar View
Shapefile to MDB with custom field structure [duplicate]
Query JET 4 database with SSIS
Microsoft Access 2010: Query Criteria moving
Is there a way to create an Access database from a Visio database model?
Access: insert multiselect box values into database
ms access extra table indexes
Recordsource vs Recordset for Unbound Forms
Access Database Remote Connection
How to programmatically convert Access 1997 .mdb to Access 2007 .accdb
Microsoft Access Duplicate Output Destination workaround
Ms access : calculated field from other table
Finding where an object in access is referenced
Queries for Importing Data from Flat-File Tables to Many-to-Many Relationship
Removing dead space from a report if a sub-report is hidden
Ms Access: At Sum of Order i want to add discount to premium users