Results 1 to 4 of 4

Thread: Access GUI

  1. #1
    Join Date
    Apr 2011
    Posts
    5

    Question Unanswered: Access GUI

    Hello, I am new to the database world and work at a small economics research department for a university as a student. Currently since I have no Microsoft SQL server experience, I am creating databases with Access. These databases are small, and do not have to be stored on SQL Server. My question is how do I create a user interface that allows a user to click/select and option which then launches a query for users to view? My co-workers are not interested in learning the Access GUI, but would rather point and click (sigh).

    Browsing the net, I, am seeing VB, VBA, VB.net as options. I currently know VB and Access SQL, but won't have any trouble learning VBA or VB.net. Any help is appreciated, I am not sure where to start with this.

    Thanks,
    Josh

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    The simplest and easiest way consists in:

    1. Create a Form (Design view, unbound, no wizard).
    2. On this form create a command button.
    3. Open the properties windows (Alt+Enter), select the Event tab and click on the 'On Click' line. The line turns into a combo box and a little button with 3 dots appear on the right side of the line (...), click on it or select '[Event Procedure]' in the combo box.
    4. The VBA Editor opens and you can see these lines (here the button name is 'Command0', it can be different in your case):
    Code:
    Private Sub Command0_Click()
    
    End Sub
    5. Add this line in the Command0_Click() procedure (here the query name is 'Query1', it can be different in your case):
    Code:
        DoCmd.OpenQuery "Query1", acViewNormal, acEdit
    6. There are several options for the second parameter (acViewDesign, acViewNormal, etc.) and for the third (acAdd, acEdit, acReadOnly). Double-click on the word 'OpenQuery' and press the F1 key to get help about the different parameters and their meanings.
    7. You should end up with some code that looks like this:
    Code:
    Private Sub Command0_Click()
    
        DoCmd.OpenQuery "Query1", acViewNormal, acEdit
        
    End Sub
    Have a nice day!

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Since you are just stepping into the world of Access, and have experience in Visual Basic, understand this: While Visual Basic and Visual Basic for Applications both have a common ancestor, QuickBasic 4.5, they are distinct languages! Don't make the mistake of thinking they are identical! The two have many Functions and Properties with identical names, but frequently these do not function in the same way!

    In point of fact, even Visual Basic for Applications differs, depending on whether it's VBA for Access or VBA for Access.

    Good luck with your project!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Apr 2011
    Posts
    5
    Thanks, your posts were very helpful.

    - Josh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •