February 19, 2009

Modify bullets and numbers to match the size of your PowerPoint slide text

  • Date: November 18th, 2008
  • Author: Mary Ann Richardson

Bullets and numbers that are out of proportion to your slide text can be distracting and ugly. This simple trick will ensure that those characters are sized just right.


Do your bullets and numbers overpower the text on your PowerPoint slides? Or are they so small you can hardly see them from the back of the room? You don’t have to settle for characters that distract from your message. For example, suppose too large numbers distract from the text as shown in Figure A.

Figure A

numbers

To daily cialis improve their appearance, just follow these steps:

  1. Select the numbered text.
  1. In PowerPoint 2002/2003, go to Format | Bullets And Numbering. In PowerPoint 2007, choose Bullets And Numbering from the Bullets And Numbering drop-down list on the Home tab.
  1. Click the Numbered tab.
  1. In the Size box, click the down arrow until 80 is displayed, as shown in Figure B, and then click OK.

Figure B

sizing

The numbers will now be 80% the size of the surrounding text, as shown in Figure C.

Figure C

smaller numbers

Permalink • Print • Comment

Save a million keystrokes by turning Access text boxes into combo boxes

  • Date: November 18th, 2008
  • Author: Mary Ann Richardson

If you repeatedly type the same text in the same field, you’re working too hard. See how to set up a combo box that will speed data entry and spare you a TON of tedious typing.


Do you find yourself constantly typing the same data in the same field? For example, say you work with an Employee Data form, and you find that you’re typing the same three Zip codes repeatedly. Since most of your employees live near your company’s three offices, you seldom need to type any other codes. By converting the Zip code text box into a combo box, you’ll eliminate the retyping. Follow these steps:

  1. Open the form in Design view.
  1. Right-click the Zip/Postal Code text box.
  1. Move to Change To and click Combo Box (Figure A).

Figure A

combo

  1. Right-click the Zip/Postal Code combo box.
  1. Click Properties (Figure B).

Figure B

properties

  1. On the Data tab, click the Build button in the Row Source field (Figure C).

Figure C

build buttondaily cialis results button” width=”302″ height=”287″ />

  1. Add the Employees table.
  1. In the field list, double-click Zip/Postal Code.
  1. Click in the Criteria box under Zip/Postal Code and enter Is Not Null (Figure D).
  1. Close and save the query.

Figure D

criteria

Now you can simply select one of the three zip codes from the drop-down list in the combo box, as shown in Figure E.

Figure E

combo box

Permalink • Print • Comment

Create blank lines in a printed Word form the easy way

  • Date: November 18th, 2008
  • Author: Mary Ann Richardson

Creating printed forms can be a hassle if you can’t get those blank lines to cooperate. Learn one of the easiest and most versatile ways to set up your form: using underlined tabs.


Word users often create printed fill-in forms that include underlined blanks spaces for writing in form data. While you can press Shift + – (hyphen) repeatedly to create these daily cialis dose underlined spaces, it’s difficult to line up the lines. Leader tabs make it easier to create even lines, as well as saving keystrokes, but you’re limited to four underline styles.

Using the Underline button to underline tab characters gives you all the advantages of leader tabs with a wider choice of underline styles. For example, say you have used tabs to lay out your form, as shown in Figure A.

Figure A

tabbed form

To create the lines, just follow these steps.

  1. Click the Show/Hide button on the Standard toolbar so that you can see tab marks in your document. In Word 2007, click Show/Hide on the Home tab in the Paragraph group.
  1. Select the first tab mark you want to underline, then hold down the Ctrl key while you select each of other tab marks (Figure B).

Figure B

tab selection

  1. Go to Format | Font, choose the thick underline style from the Underline drop-down list, and click OK. In Word 2007, go to the Home tab, click the Underline button arrow in the Font group, and select a style from the Underline style list (Figure C).

Figure C

underline format

All lines will be printed, as shown in Figure D.

Figure D

underlines

Permalink • Print • Comment

E-mail multiple recipients without sharing e-mail addresses

  • Date: October 31st, 2008
  • Author: Susan Harkins

Don’t share e-mail addresses with the crowd. When sending e-mail to several people, use this trick to hide their addresses.


cialis wholesale

Sharing e-mail addresses is frowned upon, but that’s exactly what you do every time you send an e-mail to more than one person — whether you’re creating or forwarding the message. Everyone who receives the e-mail has the address for every other recipient.  Within the same organization, or an intimate group of friends and family, that’s okay. However, it isn’t okay if you’re sending a promotion or special discount to 100 clients who don’t know one another. Depending on the nature of your business, you could lose your job.One quick option is to send the e-mail to yourself and bbc all the recipients. Doing so hides all e-mail addresses but yours. The downside of this technique is that bcc messages tend to get snagged by spam filters. That means your mail might never reach some of the recipients.

A more dependable way to send an e-mail to a list of undisclosed recipients follows:

  1. Open the New button’s drop-down list and select Contact.
  2. Type Undisclosed recipients in the Full Name control. You don’t have to use that name; give your list a meaningful name that describes the recipients or the message’s intent.
  3. Enter your e-mail address in the E-mail field.
    october2008officeblog11fig1r.jpg
  4. Click Save And Close.
  5. Create a new e-mail message.
  6. Click the To button and choose Undisclosed recipients.
  7. Click To and highlight the necessary addresses.
  8. Click OK.
  9. Enter your message and click Send.

Remember that the name you give the undisclosed contact (step 2) will show in the e-mail’s header, so give that name a bit of creative and careful thought.

Permalink • Print • Comment

How to log errors in Microsoft Access

  • Date: October 31st, 2008
  • Author: Susan Harkins

If you Google “error logging in Microsoft Access,” you’ll find a number of complex solutions. But the process doesn’t have to be that difficult. Most of us need only a simple function to log specific information about the current error.


Despite all your best efforts, errors occur in every database. Most developers include adequate error-handling routines in their code, but that might not be enough. Knowing when an error occurs and how often it occurs can be important to resolving the issue and avoiding future errors. Access doesn’t track errors, but you can add that functionality to any database. All you need is a table and a little code.

Note: Our companion download includes a demonstration database and a several .bas module files you can import into any Access database. Don’t cut and paste the code directly from here into an Access module, as the article text contains formatting that will generate errors.

The easiest way

If you have just one database to maintain and you’re its only user, error logging isn’t a critical issue because you’re around when the error occurs. However, it’s difficult to display internal error information at the time of the error. It isn’t impossible, but even if your application displays it, you have to remember all of it. For that reason alone, adding a log can be helpful, especially during the testing stage.

The simplest way to log errors is to let each procedure’s error-handling routine do it. The error routine shown in Listing A (basErrorLog1.bas) inserts a record with error information into an existing table. To create the code, select Module in the Database window and then click New on the Database toolbar. Enter the code and save the module. (You can import the .bas file into any Access database, even an empty one.)

Listing A: ThrowError()

Function ThrowError()  On Error GoTo errHandler Dim strSQL As String Dim strDescription Err.Raise 6 Exit Function

errHandler:  strDescription = Chr(34) & Err.Description & Chr(34) strSQL = "INSERT INTO tblErrorLog (ErrDate, CompName, UsrName, " _ & " ErrNumber, ErrDescription, ErrModule)" _ & " VALUES(#" & Now() & "#, '" & Environ("computername") _ & "', '" & CurrentUser & "', " & Err.Number _ & ", " & strDescription & ", '" & VBE.ActiveCodePane.CodeModule & "')" DoCmd.SetWarnings False DoCmd.RunSQL strSQL DoCmd.SetWarnings True MsgBox "Error has been logged", vbOKOnly, "Error"

End Function

The function intentionally throws an overflow error in order to execute errHandler. This code builds a SQL INSERT INTO statement using the following information: the date, the computer’s name, the user’s name, the internal error number and description, and the module that generated the error.


About INSERT INTO

SQL’s INSERT INTO statement works well as long as you use it correctly:

  • The target table (in this case that’s the error log table) must contain every field in the INTO and VALUES clause.
  • You can omit a field from the INTO clause as long as you also omit it from the VALUES clause; these two clauses must match.
  • When including field references in the INTO clause, their order must match their placement in the table (check the table in Design view, which won’t always agree with Table view).
  • Don’t include an AutoNumber field in either clause.
  • Jet won’t complain if there’s no data for a specified field, unless doing so violates a field constraint. That behavior could help or hinder.
  • You can omit all of the fields from the INTO clause, but you must account for every field in the target table in the VALUES clause.


You can customize the information to fit your needs. For instance, if no one else is using the database, you won’t need the user or computer names. Just remember to delimit each item correctly. Delimiters cause a bit of a problem for the error’s description text, as quite often this text includes single quotation marks. Assigning the text to a string variable, separate from the SQL string variable, makes the text easier to handle.

You must add this capability to every procedure to maintain a comprehensive log. In addition, before executing the code, create the error log table. The name of the example’s table is tblErrorLog, and it contains the following fields:

ErrDate: Date/Time

CompName: Text

UsrName: Text

ErrNumber: Numeric

ErrDescription: Text

ErrModule: Text

UserName and Computer Name are reserved words; even though those labels are more meaningful, you can’t use them to name a field or variable.

You can execute the code from inside the VBE. To do so, position the cursor anywhere inside the procedure’s code and press F5. Clear the message shown in Figure A. Open tblErrorLog to see the error record shown in Figure B.

Figure A

figure a

Clear the informational message.

Figure B

figure b

The table shows the new error record.

A project-level routine

Inserting error -logging code into every procedure works, but it’s inefficient. Consider calling a dedicated function, like the one in Listing B, instead. Call LogError() from each procedure’s error handling routine, as the procedure in Listing C shows. (Listing B and Listing C are in the download as basErrorLog2.bas.)

Listing B: LogError()

Public Function LogError()  'Log error information to tblErrorLog. Dim strDescription As String Dim strSQL As String strDescription = Chr(34) & Err.Description & Chr(34) strSQL = "INSERT INTO tblErrorLog (ErrDate, CompName, UsrName, " _ & " ErrNumber, ErrDescription, ErrModule)" _ & " VALUES(#" & Now() & "#, '" & Environ("computername") _ & "', '" & CurrentUser & "', " & Err.Number _ & ", " & strDescription & ", '" & VBE.ActiveCodePane.CodeModule & "')" DoCmd.SetWarnings False DoCmd.RunSQL strSQL DoCmd.SetWarnings True

End Function

Listing C: ThrowError()

Function ThrowError()  On Error GoTo errHandler Err.Raise 6 Exit Function

errHandler:  Call LogError MsgBox "Error has been logged", vbOKOnly, "Error"

End Function

When ThrowError() experiences an error, VBA passes that error to errHandler, which calls LogError(). The LogError() function inserts a new record using the error information into tblErrorLog and then returns to ThrowError().

A more compact solution

The one disadvantage to using pure SQL is that the statement can grow rather long and unwieldy. If you’re not comfortable writing SQL, this solution might be a little difficult for you. There are other reasons to avoid SQL:

  • If there are any plans for upsizing to SQL Server, avoid using Jet SQL, as SQL Server uses Transact-SQL (T-SQL). You’ll have to modify the SQL code so that SQL Server can use it.
  • If you’re using Access to work with SQL Server tables, the Jet SQL will fail. You could use a Pass-Through query, but you must be familiar with T-SQL.

An ActiveX Data Object (ADO) Recordset presents a more versatile solution than pure SQL. The code in Listing D (basErrorLog3.bas in the download) uses ADO to log errors.

Listing D: LogError()

Public Function LogError()  'Log error information to tblErrorLog using ADO. Dim cnn As New ADODB.Connection Dim rst As New ADODB.Recordset

  Set cnn = CurrentProject.Connection  rst.Open "SELECT * FROM tblErrorLog", cnn, _ adOpenKeyset, adLockOptimistic

  With rst    .AddNew !ErrDate = Now() !CompName = Environ("computername") !UsrName = CurrentUser !ErrNumber = Err.Number !ErrDescription = Err.Description !ErrModule = VBE.ActiveCodePane.CodeModule .Update End With

  rst.Close  Set rst = Nothing Set cnn = Nothing

End Function

Execute ThrowError(), and the results are the same. The only difference is that the ADO version is more versatile because it will run against a SQL Server backend, as long as you establish the right connection (update the CurrentProject.Connection shortcut the example uses, appropriately).

Add error handling to the error logging

So far, the error-logging routines haven’t included error handling. For that reason, if you add one of these solutions as is, thoroughly test it to make sure you accommodate all possible errors.

You might want to add error handling to the error-logging routine, because any error within the error-logging routine will write over the current error properties you’re trying to log. Passing the error-logging information as shown in Listing E is a simple solution. As with all the previous examples, call the error logging function by executing ThrowError() in Listing F. (Listings E and F are in download file as basErrorLog4.bas.)

Listing E: LogError()

Public Function LogError(errdte As Date, comname As String, _ usernme As String, errno As Long, errdes As String, errmod As String) As Boolean 'Log error information to tblErrorLog using ADO. Dim cnn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim varErrors As Variant Dim varFields As Variant On Error GoTo errHandler

  Err.Raise 5

  varFields = Array("ErrDate", "CompName", "UsrName", _   "ErrNumber", "ErrDescription", "ErrModule") varErrors = Array(errdte, comname, usernme, errno, errdes, errmod)

  Set cnn = CurrentProject.Connection  rst.Open "SELECT * FROM tblErrorLog", cnn, _ adOpenKeyset, adLockOptimistic

  rst.AddNew varFields, varErrors  rst.Update

  rst.Close  Set rst = Nothing Set cnn = Nothing LogError = True Exit Function

errHandler:  Debug.Print errdte Debug.Print comname Debug.Print usernme Debug.Print errno Debug.Print errdes Debug.Print errmod Debug.Print Err.Number Debug.Print Err.Description

  Set rst = Nothing  Set cnn = Nothing LogError = False End Function

Listing F: ThrowError()

Sub ThrowError()  On Error GoTo errHandler Dim booLogError As Boolean Err.Raise 6 Exit Sub

errHandler:  booLogError = LogError(Now(), Environ("computername"), CurrentUser, _ Err.Number, Err.Description, VBE. _ ActiveCodePane.CodeModule) If booLogError Then MsgBox "Error has been logged", vbOKOnly, "Error" ElseIf booLogError = False Then MsgBox "Error wasn't logged", vbOKOnly, "Error" End If

End Sub

This version of ThrowError() passes the current error information to LogError(), which purposely throws another error in order to execute its error-handling routine. Of course, when applying this to your own work, you’ll want to delete LogError()’s Err.Raise statement. The error-handling routine prints the error values only to verify that the original error values still exist, even after a new error occurs. How you handle those values will be up to you. Just remember, as is, their scope is specific to LogError(). Once VBA returns flow to ThrowError(), they’re gone. The array presents an easy but alternate way to update the log table. Stick with the ADO solution if you’re working with SQL Server tables.

Notice that LogError() is now a Boolean function procedure (no longer a subprocedure as before). If VBA successfully logs the error, the function returns True; if not, the function returns False. The calling subprocedure (Listing F) contains an enhanced If statement that returns the appropriate message, depending on whether LogError() returns True or False. Figure C shows the simple message shown when the code fails to log an error. When you apply this technique to your own procedures, you’ll want to include specific error handling. As is, LogError() merely maps the flow for you.

Figure C

figure c

Let users know when the VBA is unable to log an error.

Worth noting

This is a good procedure to add to your code library. Just drop it into any database. cialis weekend pill If you’re working with an older database, make sure to reference the ActiveX Data Objects library (ADO).

Some developers don’t like Environ(); they complain that it’s unstable. If you have trouble with this function and you need to track the computer, use the API GetComputerNameA() function instead.

Remember, you must create the log table manually. You can, however, add code that creates the table if it doesn’t already exist.

Easy error log

If you Google error logging in Microsoft Access, you’ll find a number of complex solutions. The process doesn’t have to be hard to be good. Most of us need only a simple function to log specific information about the current error, for later use.

Permalink • Print • Comment
« Previous PageNext Page »
Made with WordPress and the Semiologic theme and CMS • Sky Gold skin by Denis de Bernardy