[?] Subscribe To This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Home
Whats New!
Need a database?
Tips via email
Learn VBA
Questions Answered
Access Tips Index
What is MS Access

Line Break

 

I know there are other ways to insert a line break, but the one I use consistently with no problems, is by using the Microsoft Access constant known as ‘vbCrLf’. For example, if you have written code to create a message box such as:

MsgBox “The record has now been Saved. The database will now close”.

will display in a message box as per below, with just the OK button.

The record has now been Saved. The database will now close.

You may wish, though, to have the second sentence below the first sentence. To do this you would write the code for the message box as:

MsgBox “The record has now been Saved” & vbCrLf & vbCrLf & “The database will now close”.

The two vbCrLf forces two rows in the message box to display the message as:

The record has now been Saved.

The database will now close.

This helps to make your message box easier to read for the user.

You can also use this constant in other instances, for example in setting out text to send in e-mail messages via VBA code.

 

 

Do you like this tip? Subscribe to my Newsletter to receive tips via email. Click Here to subscribe.

 

www.simply-access.com (c) 2002 - 2009