Tips for using two non-public access methods

Source: Internet
Author: User
Tags character set implement modify ole regular expression
access|: Anonymous Source: Security protocol Network

Invited by the Yellow Sea (http:// www.accessqq.com), suddenly to write something of his own, suddenly as if do not know what to write, research access for so many years, feel is in the enterprise application, and no advanced skills, also do not belong to their own skills, had to rack their brains, squeeze something out, hoping to be worthy of the Yellow Sea and everyone:


The Application object in Access has two unpublished methods, one of which is saveastext and the other is loadfromtext. I remember just learning access soon, when the study of an analysis tool FMS, tracking found that it will always produce some temporary files, the temporary file analysis, found that it and VB in the form file format, so it is estimated that Microsoft can convert access to the form of text format, and provides a method of inverse phase conversion. So found a deep interest, and then found these two methods.

Although there are some other open properties of Microsoft, but I spend the most time on these two methods, because it does have useful value, so talk about the use of their experience over the years.

These two methods are not necessarily supported in later versions of Access. So I don't recommend it, but because there are some features that you can use to save a lot of time, in some cases I still use it, and at least the existing version of Access supports this approach. If the same functionality can be done in Access's normal way, I suggest you use Microsoft's open approach. Remember!
Use 1:

Using Application.saveastext acform, my form, c:\test.txt exports the entire form to a text file, packages it to friends, and lets friends reuse Application.loadfromtext Acform, "My form", "C:\test.txt" and then guide back. You can compress and package the transfer.

Use 2:

You can save a form to a text file, and then store the text file in an OLE field so that the entire form's interface and code can be saved to the Access data table, which is useful for writing the code library Manager. When used, you can also instantly restore a text file to a form that allows users to instantly preview the effect of this technique

Use 3:

Save the form to a file file, using regular expressions to analyze the code, you can analyze the syntax, code structure, syntax errors, word count and so on, you can refer to the FMS of an Access analysis tool, it has the function, you spend six months, do not have a big problem. Remember to let me try the source code OH:

Use 4:

The real global substitution, generally we need to replace the name of a property in the form or the content, need to be modified one after another, but not like the code in the global replacement, now export the form to a text file, in the text file for global replacement, completed and then back to the form.

Use 5:

Simplified conversion, Chinese-English conversion, general to the control title, prompt text, default value, etc. after the text simplified conversion does not really implement the simplified conversion, in the corresponding environment after the conversion of the ActiveX control can not find or OLE error, the form or other objects converted to a text file before the simplified conversion, Then convert the corresponding character set, font name, simplified corresponding name of the section, CRC check Code, and then back to access the corresponding object, you can complete the conversion of the entire Access program, the corresponding program effects can be seen in my simplified conversion general program, remember that the simplified general is 134 traditional is 136

You can speak English when you open it. I advise, if you want to do the same function, then you'd better not do it, with my on it, lest break my money, I commission 20% to you, and so on, after two years to 100 yuan, I once again remit to you:

Use 6:

Chinese-English conversion, although a small number of manual conversion, but has saved a lot of time, but how to use formal expressions to correctly distinguish which is the title, hint text, message box also requires some skills.

Purpose 7: Change the default property of a control

In addition to the default properties of the control that we modify in the design state, the effect of modifying the default property of a control can be achieved by using the content that modifies the text file, and when the form or report is exported to a text file, all forms, controls, and default control properties are reflected in the text file. You can accomplish this by modifying the settings for the default properties in this text file.

What is the default property? For example, you download a program from abroad, why add controls to the form, the control font is always serif, and the new form control in the Simplified Chinese environment, the font is "Arial", the new form control in the traditional Chinese environment, the font is "new fine body", because the default property of this control causes

Use 8:

Implement the effect of automatically creating a form template, will do the basic function of the form exported to the text file to save, to the time needed to use, direct import back immediately may have a common function of the form, do not need to start from scratch, and then do a little automation, do a rich form of functional code base, Allows users to choose a variety of different features, then choose the code you want from the code base to create a text file in the form text file format, and then automatically combine a perfect form with this text file, no need for users to program, he just select the field, select Form function, select Style, Select a template to achieve a variety of input forms, query forms, analysis forms, report statistics and so on, the writing program becomes the assembly process. When we have nothing to do, we will develop various special components. Note that copying the functionality and code in a text file is more resilient and malleable in terms of automatic programming than copying controls and code in a form.

Use 9:

If there are pictures or OLE objects in the form or report, the exported text file contains their binaries, and the regular expression or other methods are used to extract the content and then restore it to the appropriate picture file. Enables you to save the image of forms and reports to a file (access does not support directly saving pictures of image controls to a file)

Use 10:

Implement to convert access forms and reports to VB programs, now there are some professional programs to provide this functionality, I think the basic idea should be for this, the form and report to export to a file file, and then analyze the difference between it and the VB form file, and then modify the text file to adapt to the needs of the VB form can be achieved, I just don't have enough time to do this: Of course, if you extrapolate, you may also do a tool to convert VB form to access program, after all, VB resources and rich skills for access to have a great use of value

Use 11:

Modify the font name font size or other properties used in the Access object at once, and the font and other properties of the datasheet for the form can also be changed to.

Use 12:

View the GUID of forms and controls and use them for the appropriate purpose

Use 13:

Modify the form and report information about the printer, why the form's print settings cannot be saved, why open the report always prompts the original default printer does not exist, whether to use the current printer, and so on, this information is actually saved in the form and report, open the text file, everything is clear, Through this function can achieve a lot of powerful functions, we play to imagine it.

Use 14:

If you want to get some of the properties of forms and controls, you can learn a lot by using text files

Use 15:

Create some new controls, such as combo boxes, list boxes, and so on, can be copied directly inside the code to create, and more useful, some with registration information (license) control, if the original form is available, but you do not license, you copy the form will be wrong, said you do not have copyright, But if you export the form to a text file and then return a new form, access will be passed on to you, however, this method can not say that I taught:), although I tried many times before trying out, but I am determined not to use:), we all know, I generally in public, are using genuine:

Use 16:

You can use the method above to export all the objects in access to a file for backup and save, and then restore whichever you want, although this approach has its advantages, but it might be more practical to back up the entire MDB:

Use 17:

Can be used for version control, I do not know whether you have used SourceSafe in Access, I study for a short time, found that its check-in check out is using the method I said above, in SourceSafe save the text format of each object. If you are interested, you can write a similar version control tool, I expect 2008 will start to write it, if you have written before that year, it is best to send me the source code, or I accuse you of stealing my idea:

Use 18:

In addition to forms and reports, there are almost a lot of other objects, such as queries, views, stored procedures, relationships, macros, modules, etc. can be exported, you can use for a variety of purposes, here is not detailed, if you have unique findings, please tell me oh.

Note, however, that the table is not exportable:
In addition, we have to tell you that at the beginning of the 2002 (XP) version, Microsoft began to check the CRC checksum, so there may be some problems when returning the object. Maybe Microsoft already knows someone is abusing this feature:

Hasty and just, the statement does not pass or typo place, also please let go a horse:


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.