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

Using an MS-Access Form in VB?

Status
Not open for further replies.

DMG2000

Programmer
Aug 13, 2000
52
US
Is it possible to use a form created in your MS Access db in your Visual Basic application, or export to a .frm object?
 
Shawn,

As far as I know - this is a no go. BUT, If you are up to it, many/most of the controls in MS Access have counterparts in VB. It is possible (noy, not just possible but fairly simple) to write a VBA program to place the information re the controls in a table (Control Name, Type, Left, Top, Height, Width, Control Source, On????Event ...) in a table. Now, the clever programmer could write a VB program to opne that table, read the form information and translate it to the equivalent VB Control. Then the going gets tough. Some things just will not translate. You need to identify what went awry and fix it.

I have done the first part many times. I have usually work as a scab, and often need to generate some cross-reference info quickly, so I do not do any harm. The part about generating the table of forms controls and attributes is straignt forward, consisting of a loop to go through all of the objects in the database, getting the info and placing it in a table.

I have done the second part once - with only limited sucess. Building the translation table (MS Access Objects/Controls to VB Objects/Controls) was not very good when the MS Access forms were displaying multiple rows of data. Of course, SOME grid was necessary, but beyond that it ggot VERY MESSY!!!! Also, while I could get the report info, VB STILL does not compare w/ MS Access in report generation (is there some deal w/ Seagate to keep vb report generation CRIPPLED?)

MichaelRed
There is nevertime to do it right but there is always time to do it over
 
Upon searching the trusted MSDN, this is what I found:

With this in mind, knowing it is possible, I will attempt to build upon this. You have also addressed some concerns I may run into here within the next couple of hours (reports), so I may need your help again.

Thanks Michael!!!
 
This may be too late to help, but there is an Access add-in utility called form2vb that will let you export an Access form to a VB .frm file. I don't believe it exports the code behind the form, but it can certainly save some time building the form itself. I don't recall now just where I found this, but a search should turn it up.
 
Also, if not too late, there is a better program that the "form2vb" program that will also convert your access vba code, macros, modules and reports to VB. It's called AccesstoVB. Even after this conversion, there will be some clean up to do, depending on the complexity of your original access application. Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top