none
can i use visual studio to CREATE the or some or ALL of the Access Project code? RRS feed

  • Question

  • can i use visual studio to CREATE the or some or ALL of the Access Project code?

    I am NOT trying to GET from Access INTO Visual Studio.

    Thanks.

    i am using VB.NET in Visual Studio.

    thanks,

    mark J


    Mark J

    Friday, February 24, 2017 3:48 AM

Answers

  • You can’t use VS to create “all” of the code for Access.

    You can certainly write code modules and routines in vb.net, and then have access “call” or consume that code.

    It would not make sense nor is any advantage to simple “choose” to write some code in .net. (because we don't have that choice)

    However .net does have an amazing library and set of features that you might want to use from Access. So things like picture re-sizing, zipping of files or consuming web services are things that are “native” to .net. These are great features of .net and VERY easy to use! And these are the kind of features we don't have in Access.

    So if you require any of such features, then you might want to use such features from Access and VBA.

    For example, the following code will “zip” a file in vb.net:

    Imports System.IO
    Imports System.IO.Compression
    Imports System.Runtime.InteropServices
    
    <ClassInterface(ClassInterfaceType.AutoDual)>
    Public Class VBZip
    
        Sub MyZipper(strFileName As String, strZipFile As String)
    
            Using archive As ZipArchive = ZipFile.Open(strZipFile, ZipArchiveMode.Update)
                archive.CreateEntryFromFile(strFileName, Path.GetFileName(strFileName), CompressionLevel.Fastest)
            End Using
    
        End Sub
    
    End Class
    


    Above is a vb.net class project.

    Just force the project as x86, and click the "register" for com interop.

    Now, in Access, you can use createObject or even set a reference to the COM object

    The result is thus in Access you can now go:

    Sub testzip()
    
       Dim z    As New VBZip.VBZip
          
       z.MyZipper "c:\test2\text2.txt", "c:\test2\text2.zip"
    
    End Sub
    

    So extending and using .net code routines works rather well - and is easy.

    So you can certainly write some code bits and parts in vb.net that can then be consumed by Access via “COM” objects. So for code to FTP, or download files, or consume web services – all of these great features are built in and part of .net.

    However, as a “general” approach to writing some code routines in vb.net does not make much sense. You only going to drive up developer costs.

    When you need/want to use some of the great features of .net in Access it is rather easy to expose such .net code to enhance the feature set of Access applications.

    So extending and using .net features in Access is a great idea. However, just “general” writing of code really not going to gain you much. However to answer your question, no you can’t write the “general” application code in vb.net for Access - but you can "call" or "consume" .net code in Access rather easy as the above shows.

    Regards,
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada

    Friday, February 24, 2017 1:00 PM
  • Hi mark J,

    Welcome to the MSDN forum.

    Refer to your description, this issue is about the development of Access. Since our forum is to discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor, I will move this thread to Microsoft Office for Developers  >  Access for Developers for dedicated information, you will get a more professional support from there, thank you for your understanding.

    Best regards,

    Sara


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by PuzzledByWord Thursday, March 2, 2017 8:35 AM
    Friday, February 24, 2017 6:52 AM

All replies

  • Hi mark J,

    Welcome to the MSDN forum.

    Refer to your description, this issue is about the development of Access. Since our forum is to discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor, I will move this thread to Microsoft Office for Developers  >  Access for Developers for dedicated information, you will get a more professional support from there, thank you for your understanding.

    Best regards,

    Sara


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by PuzzledByWord Thursday, March 2, 2017 8:35 AM
    Friday, February 24, 2017 6:52 AM
  • You can’t use VS to create “all” of the code for Access.

    You can certainly write code modules and routines in vb.net, and then have access “call” or consume that code.

    It would not make sense nor is any advantage to simple “choose” to write some code in .net. (because we don't have that choice)

    However .net does have an amazing library and set of features that you might want to use from Access. So things like picture re-sizing, zipping of files or consuming web services are things that are “native” to .net. These are great features of .net and VERY easy to use! And these are the kind of features we don't have in Access.

    So if you require any of such features, then you might want to use such features from Access and VBA.

    For example, the following code will “zip” a file in vb.net:

    Imports System.IO
    Imports System.IO.Compression
    Imports System.Runtime.InteropServices
    
    <ClassInterface(ClassInterfaceType.AutoDual)>
    Public Class VBZip
    
        Sub MyZipper(strFileName As String, strZipFile As String)
    
            Using archive As ZipArchive = ZipFile.Open(strZipFile, ZipArchiveMode.Update)
                archive.CreateEntryFromFile(strFileName, Path.GetFileName(strFileName), CompressionLevel.Fastest)
            End Using
    
        End Sub
    
    End Class
    


    Above is a vb.net class project.

    Just force the project as x86, and click the "register" for com interop.

    Now, in Access, you can use createObject or even set a reference to the COM object

    The result is thus in Access you can now go:

    Sub testzip()
    
       Dim z    As New VBZip.VBZip
          
       z.MyZipper "c:\test2\text2.txt", "c:\test2\text2.zip"
    
    End Sub
    

    So extending and using .net code routines works rather well - and is easy.

    So you can certainly write some code bits and parts in vb.net that can then be consumed by Access via “COM” objects. So for code to FTP, or download files, or consume web services – all of these great features are built in and part of .net.

    However, as a “general” approach to writing some code routines in vb.net does not make much sense. You only going to drive up developer costs.

    When you need/want to use some of the great features of .net in Access it is rather easy to expose such .net code to enhance the feature set of Access applications.

    So extending and using .net features in Access is a great idea. However, just “general” writing of code really not going to gain you much. However to answer your question, no you can’t write the “general” application code in vb.net for Access - but you can "call" or "consume" .net code in Access rather easy as the above shows.

    Regards,
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada

    Friday, February 24, 2017 1:00 PM
  • No, you cannot create Access database projects using Visual Studio. You need to use the Access application to do this.

    It is possible to create an Access database, create tables, querydefs and some other objects by running Access SQL DDL from the Data Designer or .NET code, but there is no designer to create Forms and write VBA code.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, February 24, 2017 1:09 PM
  • Albert D. Kallal,

    Thanks very much.

    The extra info was VERY, VERY helpful.

    I was a little surprised when i saw the VS templates for Word and Excel and I could NOT find one for access.

    When i used the templates that VS offered, it was great. I had (as far as i could tell ) the complete word or excel program in VS. And word was usable while in the VS program while i was in VS.

    AND

    and when i closed VS and word or excel.    Then opened just word or excel  the code i added with VS was still there and working.

    also sorry about the delay.

    I use the outlook part of office suite.    NOT the web browser version, due to MORE THAN one email account, and other accounts not from Microsoft and was getting those msgs..  

    After first time the improved version stopped me getting any msg from Hotmail account, i did the fix. got my mail from Hotmail. Then got msg again to reenter Hotmail account. i stopped looking at msg after all i was getting the msgs from all accounts including the one from Hotmail. 

    my error in not checking if msg from Hotmail were being blocked when i did not get any msg from the forums.

    again sorry about that.

    Mark J

     

     


    Mark J

    Thursday, March 2, 2017 8:06 AM
  • Paul,

    My confusion was when i noticed i could download IN   VS  templates for Word and Excel.

    Those templates when i used them, was like I had the complete word or excel program running in VS.  And as far as i could tell ( as many word or excel menu items I tried they behaved just like if i had word running WITHOUT   VS running.   Yes i did not test every possible item, i did try more than a few.

    And i could NOT find a template for access.  I could not tell if it was because i wasn't looking in right spot or template for access did not exist.  Or was just not for the free version of VS.

    thanks,

    Mark J

    p.s. the delay in my replay was do to Microsoft "improvement" of outlook.  I don't use browser outlook, i use outlook of office suite, due to more than one email provider for me.  "improvement" prevented emails ONLY from hotmail accounts.

    I got it fixed, again, for now.

    Thanks again,

    Mark J 


    Mark J

    Thursday, March 2, 2017 8:21 AM
  • Sara,

    Sorry about posting to wrong forum.

    But i was asking about Visual Studio features.

    I had downloaded in Visual Studio, VS templates.   The ones for Word and Excel, that when used in VS, it was like a complete version of word or excel was running in VS.  I could click on any tab and then on any item in tab and have word or excel behave ( as far as i could tell ) behave just like i was running it without visual studio also running.

    And what code i added to word or excel, was there when i exited visual studio.

    Yes i did not test every menu item.  But every word or excel item i tested worked just like i was running word or excel alone, and not from inside of visual studio.

    i hope this makes it clear why i posted to the original forum and NOT access forum.

    thanks for your help. I did get info that was helpful.

    Mark J


    Mark J

    Thursday, March 2, 2017 8:34 AM
  • Albert D. Kallal,

    I do have a question about the 3 lines below.  To see if I understand.

    Imports System.IO
    Imports System.IO.Compression
    Imports System.Runtime.InteropServices
    

    1. is the Imports System.IO.Compression

         just to access ZipArchive and ZipFile.Open ?

    2. Is the Imports System.Runtime.InteropServices

        just so i can call the .net code in access.

    Thanks again,

    Mark J


    Mark J

    Thursday, March 2, 2017 8:52 AM
  • I've never used the Office document templates but I suspect it's a documents vs. database issue. All of the Office documents implement the same document standards while Access is a proprietary DBMS. Visual Studio does provide a Data Designer facility that supports Microsoft Access through the OLEDB Provider, but does not provide integration with Microsoft Access so many of the features are not available. I think the assumption is that if you are working with an Access database in Visual Studio, then you are developing the user interface using Visual Studio projects (e.g. Windows Forms, Web Forms) and not Access Forms, which are fundamentally different.

    I would be perfectly happy if they incorporated (or even just integrated) Microsoft Access into Visual Studio .NET, but I'm sure there are many Access users that would probably feel alienated if Microsoft did this. It's that VBA vs. VB.NET thing.

    From what I know you still need to have the Office apps installed in order to work on the VS templates for Office.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thursday, March 2, 2017 1:41 PM
  • Paul,

    thanks for additional info.

    Sorry took so long to get back.

    I have been spending way more time then I want to, to get the NON-browser version of outlook I have running correctly.

    I have been slow in returning emails for reasons below.

    To reduce my use of swear words, I will not mention anything about person(s) thinking it was a good idea to FORCE a update, THAT YOU NEEDED INFO FROM BEFORE UPDATE WAS INSTALLED,

    AND "NOT" HAVE SOMETHING LIKE “before you install this you will need these bits of info TO enter AFTER update IF YOU WANT THE NEW IMPROVED VERSION TO WORK.  

    Didn’t anyone realize that not everyone works the day shift?   So a notice the same day of update would create problems?

    Especially one with no advance warning, not even one day!

    Outlook (office suite not browser ) became unusable, same day got warning to get info was same day improvement was installed.

    Making me unable to get email from Microsoft and others.  

    I will say the outlook support team got it working AGAIN.  THIS time outlook still working correctly. That maybe due to no more improvements to outlook.


    Mark J

    Thursday, March 16, 2017 10:33 AM
  • I missed this follow up, but yes to your 1 and 2.

    In fact:

    System.IO - that gives me "path" functions/features to pull out a file name from a given path.

    System.IO.Compression - that gives me use of the zip library. Note that this requires .net 4.5 or later.

    .InteropServices - That creates the "COM" object.

    Regards,

    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
     

    Friday, March 17, 2017 4:24 PM
  • Albert D. Kallal,

    Thanks for the follow up info.

    IT WAS VERY HELPFUL.

    thanks again,

    Mark J


    Mark J

    Sunday, March 19, 2017 5:58 AM