All Office/Access Developers Tips



Avoiding a SQL log-in prompt

Suppose you have an SQL server backend for an Access front-end, and you have linked SQL tables. When you open the table, you're prompted for an SQL login. You can avoid this log-in prompt by entering the following code, which re-links the tables on database startup and passes the connection string to the ODBC DSN:

'Rebuild Links. Check for number of tables first.
Set db = CurrentDb
intNumTables = db.TableDefs.Count
' Loop through all tables.
' Reattach those with nonzero-length Connect strings.
intI = 0
For Each tdf In db.TableDefs
  ' If connect is blank, its not an Linked table
  If Len(tdf.Connect) > 0 Then
    intI = intI + 1
    'append uid & pwd to the connection string (table
    'description has the connect properties)
    tdf.Connect = tdf.Connect & ";UID=sa;PWD=;"
    tdf.RefreshLink
    'If one link bad, return False >
  End If
Next tdf

Prabha Bhat



Changing case

You can easily change the case of a word or words in a Word document by highlighting the selection and pressing [Shift][F3]. By repeating the [Shift][F3] keypress, you can change the word to all caps, all lowercase, first-letter caps, or all lowercase.

Marie L. Whisnand



Making Cancel the default

If you're designing a form that lets the user perform a task that can't be undone, you may want to make the Cancel button the default button. To make it the default, set the button's Cancel and Default properties to True. Now if the user presses [Enter] by mistake, the default action will simply close the form without taking any unintended action.

ZD Journal's Microsoft Office Developer's Journal



Printing a file list

You can easily print a list of files from Outlook. In Outlook, click the Other button on the Outlook bar. Now, click on the My Computer icon. In the My Computer window that appears, locate the drive and folder you're interested in. Choose the File | Print menu item to print a list of the folders and files at that location.

Judy Levine



Review without changing

Sometimes, you may want to let others review a Word document, enter suggested edits, and insert comments--but protect the document from other types of changes. To allow tracked changes or comments, choose the Tools | Protect Document menu item, select the Tracked Changes radio button, and click OK. To restrict reviewers to entering comments, select the Comments button in the Protect Document dialog box.

ZD Journal's Microsoft Office Developer's Journal



Sizing one pixel at a time

To make a drawing object's location very exact, you can nudge it one pixel at a time. Select the object, then hold down the [Ctrl] key while pressing the arrow keys. Pressing the up and down arrows will move the object vertically, while pressing the left and right arrows will move it horizontally.

ZD Journal's Microsoft Office Developer's Journal