Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import VB form to Access

Status
Not open for further replies.

BSman

Programmer
Apr 16, 2002
718
US
I'm trying to support an application written in VB 6.0 which uses an Access database. Because of the extensive modifications needed and my preference to work in Access 97 or 2000 versus VB (which I don't have experience in, just a lot of VBA experience), as well as the rather convoluted nature of the way the application is written, I'd like to rewrite it in Access.

The problem is that there are two VB forms which I want to import into Access, rather than attempt to recreate them. They are both maps showing routes with controls at various points along each route. The controls are turned red or green depending upon the status of each point. There are probably over 200 of these controls on each of the two map forms (the map is the background image), thus the reason I want to import the two forms.

I don't care about the VB code in back of the form. I just want to import the form itself--i.e., the map and all of the (properly placed and named) controls.

Does anyone know of a way to do this? I can't find anything in the Access references.
 
There is no Microsoft way to do this. There may well be commercial programs you cn buy that will enable you to do this. But because of the nature of the form, there may be more of a fudge factor than is acceptable to you in the converted form. I would google for some software, take a look at what they have to say, and get in touch with the companies, asking them if their products would be able to handle what you want to do.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developers' section of the site for some helpful fundamentals.
 
You could in the VB application create a For Each procedure getting as much info about each control, type, name position and appending this to a table.

In Access you could use this table to reproduce these controls using the CreateControl Method, with a bit of luck you might even be able to use the existing code behind the VB Controls.

Worth experimenting a little.
 
Actually, in VB you don't need to loop through the controls. ALL VB files are just straight TEST FILES. To see the Form "File", open WordPad, and select any VB (form) file. The "top" looks like a series of UDT references to the properties of the form and the individual controls, with ONLY the custom properties. Following the Form/controls (custom) properties, the code is listed.

If you simply save the form, controls and code sections seperatly as .Txt files, it should be reasonable easy to simply read at least the controls properties and create the controls directly from the saved section of hte VB form file. For the Map, I would assume that it is (again) just a custom property of the form and can be simply ported to Ms. A.

On the other hand, working in VB as opposed to Ms. A. is really NOT a big deal so (in my opinion) the effort to re-create to forms in Ms. A., is probably the near equivalent to simply learning the VB variances. Further, the "BOSS" may not want to have the conversion done. At the least, if it were me, I would have a "frank" discussion with the "BOSS" regarding the difference, the schedule and the future maintenance, security and use of the app. It would also be necessary to consider wheather the app would continue to be executed in the "split" mode (seperate the data from the forms. queries, reports, ...). If it is multiuser, you certainly need to do this, and the 'advantage' of going to Ms. A. would (to me decrease). A final concern would be any reports generated in VB (or the omnipresent Crystal Reports need to be reviewed, as the additional expense and effort of converting these to Ms. A. would be somewhat balanced by the discontinuance of the program.


MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
I'm afraid it won't work, but it might be worth to try it. Because Access supports sourcesafe, it is able to import and export to text files. It is in a hidden method Application.SaveAsText. To show this, go to the object explorer (shift-F2, I believe), right-click on the method pane and select "show hidden members".
Now, in the debug window, type
Code:
Application.LoadFromText
and give the filename and the name of the VB form.


Best regards
 
Just to clarify (even though it seems confirmed that you can't import a form from VB into Access), I really don't care about the code in back of the VB form. All I really need to import is the image (background) and all of the controls placed properly on the image with their names.

Creating the code in Access to change the appropriate controls to red or green (which is what happens) is simple. But re-creating the form, i.e., placing what are probably 300 or more controls on the map, is what I don't what to try to duplicate.

I will be trying to do what DonQuichote suggests and if I get it to work I'll make a note here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top