Careful use of variables and the storage space it occupies can effectively reduce the resources consumed by an application, while also comprehensively improving its performance. Improper calling of Windows application interfaces may lead to unexpected side effects, as well as potential damages to the code and data segments of an application. Correct use of an empty 32-bit pointer is essential in Microsoft Access.
When performing operations on tables and reports, Microsoft Access has a feature that does not have formal text. This feature allows you to call the process from the sheet window of the design window. When you call the method, press the shift and F2 keys at the same time.
Introduction
Microsoft Access Basic provides a rich development environment. This development environment gives you sufficient flexibility and control over Microsoft Windows application interfaces, while protecting you from the various troubles you encounter when developing environments in advanced or low-level languages. However, many optimization, effective data, and modularity aspects can only be used by Application designers. Developers should focus on using algorithms with caution. In addition to general program design concepts, there are also some special storage space management technologies. correct use of these technologies can improve the application execution speed and reduce the storage resources required by the application.
Increase speed and reduce code volume
You can use several techniques to increase your encoding speed, but you cannot find a replacement for an effective algorithm. The following suggestions can increase the encoding speed and reduce the storage space consumed by your applications.
Mathematical computation using Integer Data Types
Even if Microsoft Access uses a federated processor to process floating-point arithmetic, integer arithmetic is always faster. If your calculation does not contain decimal places, try to use integer or long integer instead of variable or double integer. Integer Division is also faster than floating-point division. When using other valid data types, the warning is that nothing can replace the valid algorithm.
Avoid using process calls
Avoid using subprograms or functions in the loop body. Each call increases the coding burden due to extra work and time. Each call requires that the local variables and parameters of the function be pushed to the stack. The stack size is fixed and cannot be increased at will, and shared by Microsoft Access at the same time.
Exercise caution when using an indefinite data type
The variable-length data type provides greater flexibility, such as allowing correct handling of null values and automatic handling of overflow. In addition, this data type is larger than the traditional data type and consumes more storage space. As mentioned above, variable of variable length data type is relatively slow in mathematical calculation.
Store frequently used attributes with variables
It is faster to search for and set variables than to perform these operations on attributes. If you want to get or view a property value for many times, assign this property to a variable and use this variable to replace the property, then your code will run much faster. For example, in a loop, you can view a controlled attribute in a table, and allocate the attribute to a variable outside the loop, then, it is faster to query a variable in the loop instead of checking an attribute.
Preload table
When your application is started and their visible attributes are set to 'false', if you have installed all your tables, then the performance of your application will make you feel fast. To display a table, you only need to set the visible attribute of the table to 'true', which is much faster than installing a table. Remember that for each table you have installed, You need to consume storage space from the global heap of the application.
Traps in Access Basic
In Access Basic, the common trap is to call the external process in the dynamic Connection Library DLLS. When you provide a program to your users, you will receive a warning when calling the external dynamic link library. Otherwise, you will get an error message: trying to install the module with the same function definition.
Use a unique alias
In Access Basic, If you know the name of the function in the dynamic link library of the entry point), you can call the external function in the dynamic link library. However, the restriction of using this method is that you can only declare external functions once. If you have installed the same Windows application interface called by your module, you will not get an unknown error: trying to install the module with the same function definition.
The module you are trying to install either contains the same function name or the process name contained in an existing module. Delete these processes and use the FIND command in the EDIT menu to FIND the duplicate process name. To solve this problem, you need to use a technology called "alias usage. This technology allows you to give your process a unique name. However, the alias you select may not be unique, so to make your name unique, you can use the initial value and underline to first declare all the processes you call from the dynamic link library, for example, declare getActiveWindow:
Declare bcb_GetActiveWindow Lib "Kernel" Alias "GetActiveWindow" () As Integer. |
How to pass a null pointer to the dynamic link library
A null 32-bit pointer is valid or requires a parameter for some dynamic link libraries. To specify a null value, use 0 &. When your function calls a process and passes an expression 0 &, "&" to specify a 32-bit NULL pointer, In the function declaration, an as any parameter indicates that Access Basic does not check the type of the parameter, and transmits the value to the called function.