SOLVED: Microsoft Access 2007 2010 2013 Beginner Tips

I am an old FoxPro guy and gave up development about 10 years ago (best decision I have ever made) but I needed to write a very basic app to track visitors in Access.  When I was writing my Visitor Management software I needed to lookup a number of items I don’t want to forget.  Below is my brief set of tips and reminders for Access:

  1. How to set an Icon in the Title Bar:
    – Click FILE (or the OFFICE BUTTON)
    – click the ACCESS OPTIONS button
    – click CURRENT DATABASE
    – Set the APPLICATION ICON
  2. How to automatically Start an Form in Access: http://msdn.microsoft.com/en-us/library/cc136539(v=office.12).aspx
    – Click FILE (or the OFFICE BUTTON)
    – click the ACCESS OPTIONS button
    – click CURRENT DATABASE
    – Set DISPLAY FORM
  3. How to stop the error:
    A Potential Security Concern Has Been Identified.
    This location May be Unsafe
    – Click FILE (or the OFFICE BUTTON)
    – click the ACCESS OPTIONS button
    – click TRUST CENTER
    – Click TRUST CENTER  SETTINGS… button
    – click TRUSTED LOCATIONS
    – click ADD NEW LOCATION
    – set the path to your Access database
  4. How to add an IMAGE to an Access table: http://www.brighthub.com/computing/windows-platform/articles/40641.aspx#secn_3
    You can embed graphics right in a table to most developers don’t because of the potential to turn your small text based database into a bloated mess… so MOST developers just link graphics to Access and in 2007 2010 and 2013 this is pretty easy:
    – Open your Access table
    – Add a new column
    – Set the type to ATTACHMENT
    – Close the access table
    You can then go to your form you want to have the graphic linked to, click EXISTING FIELDS (in the Ribbon) and drag that linked field onto the form.  When you OPEN the form, and click on that PICTURE field you will see an ATTACHMENTS  windows pop up.
  5. How to enter todays date?  Use the NOW() function
  6. How to set the WIDTH of a form:  You can’t: http://msdn.microsoft.com/en-us/library/bb216043(v=office.12).aspx
  7. How to print a single record:  FROM: http://allenbrowne.com/casu-15.html
  • Open your form in design view.
  • Click the command button in the toolbox (Access 1 – 2003) or on the Controls group of the Design ribbon (Access 2007 and 2010), and click on your form.
  • If the wizard starts, cancel it. It will not give you the flexibility you need.
  • Right-click the new command button, and choose Properties. Access opens the Properties box.
  • On the Other tab, set the Name to something like: cmdPrint
  • On the Format tab, set the Caption to the text you wish to see on the button, or the Picture if you would prefer a printer or preview icon.
  • On the Event tab, set the On Click property to: [Event Procedure]
  • Click the Build button (…) beside this. Access opens the code window.
  • Paste the code below into the procedure. Replace ID with the name of your primary key field, and MyReport with the name of your report

Private Sub cmdPrint_Click()
    Dim strWhere As String

    If Me.Dirty Then    ‘Save any edits.
        Me.Dirty = False
    End If

    If Me.NewRecord Then ‘Check there is a record to print
        MsgBox “Select a record to print”
    Else
        strWhere = “[ID] = ” & Me.[ID]
        DoCmd.OpenReport “MyReport“, acViewPreview, , strWhere
    End If
End Sub

 

This website uses cookies.