Trying to make an effective calendar in Microsoft Access

I am working on a hardware management system using the MS Access.mdb file for the front end and SQL Server 2008 for the back. If necessary, I can convert the external interface to an MS Access 2010 file.

I created a calendar form where users can see what equipment is booked, issued, or earned. It looks like this:

enter image description here

I did this using 42 subforms, which is unfortunately slow. With the data shown above, loading takes only about 5 seconds, but as soon as I use real data, it starts to really hurt unacceptably. I tried to make this more efficient by keeping the original subforms object empty until they were shown, and also did not load the record sources until that time. This helped enough so that the above example runs fast enough, but for real data this is not enough.

So, what I would like to do is either find a way to make it effective while still using subforms, find another control that works instead of subforms, or switch subforms with lists, but somehow still be able to format the colors of the lines. I understand that this is not possible with listboxes, as it is, but I am a programmer, and I am ready to try to list lists for this if it does not spend too much time. Unfortunately, I have never done subclasses of vba, so for this I would need to point out good resources.

The code for setting the recording source for each daily form is as follows:

f("sub" & X & Y).Form.RecordSource = "SELECT * " & _ "FROM QRY_Calendar " & _ "WHERE CDate(StartDate) <= #" & curDate & "# " & _ "AND ((EndDate IS NULL OR CDate(EndDate) >= #" & curDate & "#)" & _ IIf(CDate(curDate) <= Date, " OR ((Date_In IS NULL OR CDate(Date_In) >= #" & curDate & "#) AND Date_Out IS NOT NULL)", "") & ") " & _ "ORDER BY IIF(Date_Out Is Not Null And (Date_In Is Null Or CDate2(Date_In)>=#" & curDate & "#) And CDate2(EndDate)<#" & curDate & "#,0,iif(CDate2(Date_Out)<=#" & curDate & "# And (Date_In Is Null Or CDate2(Date_In)>=#" & curDate & "#),1,2)), ID" 

QRY_Calendar is as follows:

 SELECT B.ID, Person, Initials, ProjectNum & '-' & ProjectYear & '-' & Format(TaskNum,'000') AS Project, Sign_Out_Code, Value AS Type, StartDate, EndDate, Date_Out, Date_In FROM (((TBL_Booking AS B INNER JOIN TBL_Person AS P ON B.PersonID = P.ID) INNER JOIN LKUP_List AS T ON B.EquipTypeID = T.ID) LEFT JOIN TBL_Usage AS U ON B.ID = U.BookingID) LEFT JOIN TBL_Equipment AS E ON U.Equipment_ID = E.ID; 

StartDate and EndDate in the table TBL_Booking is the beginning and end of the reservation, and Date_Out and Date_In in the table TBL_Usage is the beginning and end of the statement. Each departure is associated with a reservation through a foreign key. If Date_In is NULL, it means the hardware is not currently signed.

LKUP_List is a poorly named table before I started working this year ago, and I never bothered to change. It contains a list (among other things) of equipment types. Orders for types of equipment, not for specific items, and when a user signs his equipment, an entry is created in TBL_Usage that is associated with a specific equipment.

If anyone has any ideas in which direction I should take this, and where I can find guidance, it will be very appreciated.

+4
source share
5 answers

First of all, loading 42 subforms of the access form is very fast, and in fact I do it for years and years, and the loading time of 42 subforms is actually instant.

Thus, this suggests that readers may ignore some comments here, suggesting that script-based or text-based systems, such as HTML, will somehow work faster inside some browser rendering system than a desktop application high-performance Windows that has the direct ability to directly record a graphics card.

Remember that if you have simple and basic knowledge that Windows desktop applications can write directly directly to video cards, few will try to compare and assume that the rendering system in HTML has a real hope of comparison in terms of speeds if we go to compare two different architectures here.

So, the real problem is how quickly you can make a calendar calendar, and will 42 subforms be a problem?

The answer is that 42 subforms are not a problem and are FAST!

The next instant access to my resource is displayed instantly.

enter image description here

The aforementioned mine access calendar has been used for many years, even under production conditions. Even if calendars have every day with ADDITIONAL data that cannot fit on the screen, it starts at boot time. A good number of them work, in which the desktop (client) gets into the backend of the SQL OVER STANDARD INTERNET server with the hosted version of the SQL server running on the website. And even in this case with limited bandwidth, the download time and calendar response are close to instant. Thus, performance is no problem, even though I am using accDB (file-based) back-end, using SQL server for the back, and even more amazing, and as already noted, this form works well with many of my clients working with this OVER access calendar are regular Internet connections in which the back end is an SQL server running on a hosted website. And I even have a version working with the end of SharePoint (list), and again it works without problems and there is a noticeable delay.

The above design has 42 subforms, and, as noted without data, subformats load absolutely instantly. It is important to indicate this, and therefore I presented some real facts and factual data in order to humiliate other comments made here by those who clearly do not understand and do not understand the basic computer architecture. These people, therefore, suggest that loading 42 subforms somehow arises in terms of slowing down the software, when in fact I can easily demonstrate that this is not the case. Thus, the testimony of witnesses and the testimonies of others here may be unfounded, and therefore this point of view is based on the LACK understanding of how basic computer operations work in our industry. HTML cannot hope to compare with such a setting here.

And speaking of web based now that Access allows web publishing, I am posting the next video from a Calendar created in Access that runs in a web browser. This browser-based browser was built ONLY using Access and without any third-party tools.

http://www.youtube.com/watch?v=AU4mH0jPntI

As a result of the above video, the BUTTER SMOOTH version and the instantly responsive web version of this Calendar application are displayed.

Now I have to point out that in the above example on the website I do not use 42 subforms, since in the web browser each form is a separate frame and causes the form to be rendered again from the server. This means there is no answer for the Access website based on 42 sub-forms. You will get huge success in terms of rendering (even if there is no data, since the XMAL form does not load on demand to save time, but in this case this setting hurts).

However, as shown in the video, the solution for the website (as well as for working on the basis of the client) was supposed to populate the table into which you bind the text fields to this table. Thus, the presence of a single recording display, as noted and shown in the video above, shows that such a result means an almost instant response and as noted even in a web browser.

I emphasize the WEB-based application in that the video was only created using Access and other tools.

Now back to the performance issues and client application. The problem, of course, when we NOW KNOW that loading 42 subforms is not a problem.

Of course, the problem is that in SQL queries 42 separate SQL queries with all kinds of expressions, in order to extract data into these subforms, there is a bottleneck and slow performance. Thus, the performance issue will NOT change if we use 42 text fields or even 42 lists.

So the problem is trying to execute 42 separate SQL queries. Keep in mind that each SQL query takes time to parse, time for syntax checking, and then query plans, etc. In fact, a fairly large number of actions must occur before the data even begins to flow for one given request. In fact, I find that a single request can cost about 10,000 lines of data flow in terms of bandwidth.

Based on the above information, the reason why my project of my 42 such subcategories can be downloaded and executed instantly is due to the fact that I perform ONLY ONE QUESTION to return data for the whole month. In other words, I am executing a query with a start date and an end date. Then I run the VBA code to process the data from the resulting reocrdset in subparagraph 1 to 42. Thus, the VBA code fills the resultant recordset data into 42 subforms. Thus, this is the key concept and proposal here to ensure high performance computing and no slowdown.

So, in conclusion and conclusion:

The performance drawback is not the use of 42 auxiliary forms, but the presence of 42 sets of records and 42 queries, and potentially additional code and expressions should be evaluated 42 times. Eliminate 42 queries and 42 times, and RE will execute such SQL queries, and this bottleneck will largely evaporate.

I dare to argue that using 42 lists or even a total of 42 text fields and executing 42 such SQL statements will not bring any significant performance improvements.

+3
source

A question related to calendars was asked not so long ago: Creating a “calendar matrix” in Access

However, you will probably never achieve good performance with 43 subforms related to non-trivial queries.

Minor Potential Improvement

You do not say that your data is on the backend server, in which case each subformation must receive data over the network.
In this case, you might be better off making a single request to the server to pull out all the data and cache it in the interface. Then you just need to do the filtering on the local table, which should be faster, although 42 subforms are likely to be a big hurdle to performance.

A simple INSERT INTO query can start you if you created a local table called myCacheTable based on the returned data from your regular query.

Lightweight controls

The first thing you should probably try is to use the venerable listbox .
This is a fairly light weight, and there are many ways to configure them.
If you combine this with caching data from the server, as I mentioned above, you can get better performance.

Listbox example

Web UI Elements

As HelloW mentioned, it might be a good idea to just use the text fields set to TextFormat = RichText and provide them with simple HTML (it does not support much) to format the data inside:

RichText Textbox example

Full web page

It may be a little more complicated to set up, but it can be difficult to hack from the point of view of the user interface, you could use an existing Javascript library, for example FullCalendar or paste your own html directly into the browser document (you can use a simple <table> to format the calendar).

Here is an example of what an example online calendar looks like inside an access control WebBrowser control:

web calendar view in Access

+3
source

I agree with the idea that this will work best in HTML.
Replace each subform with a text field formatted for rich text. Then, when loading the form (or some other event), get a set of records for the month and skip it by adding text to each text field. An accessible subset of HTML is usually enough to get most of the formatting you need.

Considerations

  • It will take some real idea of ​​how vba goes. Most likely, you are okay with this, since you have already achieved this.
  • There is only one request, so the speed may be more acceptable.
  • Your key HTML tags will be <br> and color tags
  • You will not be able to change the background color only the color of the text (maybe I'm wrong here)
+2
source

Another solution would be to make many text box controls, each of which will represent a calendar day entry.

You run 1 request-fast!

In VBA, loop through each control of the text field and assign it a horizontal and vertical position, content (value), format, visibility (you do not need to show those who do not have data).

Down - you need to decide in advance how many text field controls you need, and maybe this will not be enough for all the records that were requested.

To overcome this problem, you can arbitrarily decide that you have 100 controls that only show the more important entries from your recordset (for example, expired ones) at first and note that "not all entries are shown." If the user wants to view all records, he clicks a specific date, and a more detailed subform opens, in which all records for this date are displayed.

I have never tried on a calendar, but I have a Gantt chart form showing temporary bars. Each temporary panel is a text box control. I have 120 controls and it works instantly.

+2
source

Another solution is to use Tcal, which I just upgraded to version 1.4.2 What is Tcal? Tcal is a cross-platform Client-Server calendar with a full graphical interface. Using TcalServer and TCP / IP, Tcal records events, dates, and working hours in personalized FileMaker Pro, Microsoft Access, or MySQL file files. You can distribute resources and job names to your events, view other resource calendars, and accept or decline invitations. Tcal runs on Mac OSX and Window (7 or XP) and is FREE, for a maximum of 2 connected users. You can find Tcal here: http://www.tcal.it/eng/index.html

0
source

Source: https://habr.com/ru/post/1446354/


All Articles