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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Forms to VB project? 1

Status
Not open for further replies.

mikeyb540

Programmer
Jul 7, 2003
173
US
Just a Q... Is it possible to transfer my A2000 forms to a VB project?
 
Hi,
Yes, it is possible, but not that easy to do. As you know, a VB form is a text file with the .frm extension. If you print out a simple form, you will see how the VB form is structured. I wrote an FAQ on how to write to a text file (see faq703-3767).

On the Access side, all forms are stored in the AllForms collection. Here is some information from the Visual Basic help inside of Access:

AllForms Collection Example

The following example prints the name of each open AccessObject object in the AllForms collection.

Sub AllForms()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllForms collection.
For Each obj In dbs.AllForms
If obj.IsLoaded = TRUE then
' Print name of obj.
Debug.Print obj.Name
End If
Next obj
End Sub


So, each form object has properties, which can then be written to your form text file.


HTH, [pc2]
Randy Smith, MCP
California Teachers Association
 
Hi,
Obviously, there is alot more to it than just this. For instance, your form will have some properties that are specific to the form, such as recordsource, size, backcolor, forecolor, etc. Then, each control on the form will also have some unique properties, including the type of control, size, location, etc.
You may want to start exploring the MSDN area for Access 2000 for "object models". Here are a few links to get you started:
Controls on forms:

AllForms Collection (on MSDN)

Controls collection

Hopefully, this will be enough to get you started in the right direction. HEY, you might even be able to sell this utility later!!!!



HTH, [pc2]
Randy Smith, MCP
California Teachers Association
 
It is also possible to add the Ms. A. Forms 2.0 To the references for a VB project. If you do not do this, some of hte pproperties of the Ms. A. Forms will not be available to the VB version os the forms / controls and you will get errors in the VB version. Although I have not attempted to do so, it may be possible, with the Ms. A. Forms 2.0 reference in the VB project, to simply use the copyobject method in VB to just get the complete form object from the Ms. A. App.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
I think i opened a major can of worms :)
Thanks for you feedback Randy and Michael

Started playing with AccessToVB 4.7
What a headache!!! More time to convert then re-do my forms in VB6
 
?????????/ Access To VB 4.7 ??????????!!!!!!!!!!!!


Which specific PRE-HISTORY organization are you with??????







MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Hey... I just relized your sarcasm.
Its the lates relase out there.

What's the problem?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top