Above Header LeaderBoard <body> <!--Google Navigation Bar--> <script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener("load", function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <iframe src="http://www.blogger.com/navbar.g?targetBlogID=34083602&amp;blogName=LEARN+MS-ACCESS+TIPS+AND+TRICKS&amp;publishMode=PUBLISH_MODE_FTP&amp;navbarType=BLUE&amp;layoutType=CLASSIC&amp;searchRoot=http%3A%2F%2Fblogsearch.google.com%2F&amp;blogLocale=en_US&amp;homepageUrl=http%3A%2F%2Fwww.msaccesstips.com%2F" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="30px" width="100%" id="navbar-iframe" allowtransparency="true" title="Blogger Navigation and Search"></iframe> <div></div>
Header Right Columns
www.msaccesstips.com

LEARN MS-ACCESS TIPS AND TRICKS

Home

LEARN MS-ACCESS TIPS AND TRICKS

↑ Grab this Headline Animator

Your Ad Here
Tuesday, September 12, 2006

Border2D Heading Text



MS-Access Forms & Report Design Tools are very easy to use and needs only little practice to master them. But creating Controls like the above manualy is very difficult. The above heading with White Border sorrounding the text with Red Color can be created easily with the following Function. Copy and Paste the Code in a Global Module.

Note : Before Running this Function ensure that the essential Project Library files that I have mentioned in my earlier Post Command-Button Animation are linked to your Project as well as the Main Programs given under the TopicCreate 3D-Headings on Forms are copied and pasted into a Gobal Module in your Project. If not, open that Post and copy and paste the Code into a Global Module in your Project first. Then copy the following code into the same Global Module or in a different one and save it.


Public Function Border2D(ByVal intForeColor As Integer, _
ByVal intBorderColor As Integer, _
Optional ByVal Label0Text1 As Integer) As String
'------------------------------------------------------------
'Author : a.p.r. pillai
'Date : September 2006
'------------------------------------------------------------
Dim intlbls As Integer
Dim j As Integer, ForeColor As Long, BorderColor As Long
Dim lblName() As String, X As Integer, mySection As Section
Dim l As Long, t As Long, intFSize As Integer

On Error Resume Next

Border2D = FormTxtLabels(Label0Text1)

Set mySection = MyFrm.Section(acDetail)

intlbls = mySection.Controls.Count - 1

On Error GoTo Border2D_Err

X = Validate_Dup(MyFrm, 5) ' check type and duplicate

If X = 1 Then
Exit Function
End If

intlbls = mySection.Controls.Count - 1

X = intForeColor
intForeColor = IIf(X < 0, 0, IIf(X > 15, 15, intForeColor))
X = intBorderColor
intBorderColor = IIf(X < 0, 0, IIf(X > 15, 15, intBorderColor))

ReDim lblName(0 To intlbls) As String

ForeColor = QBColor(intForeColor)
BorderColor = QBColor(intBorderColor)

For j = 0 To intlbls
lblName(j) = mySection.Controls(j).NAME
Next

For j = 0 To intlbls
With mySection.Controls(lblName(j))
.Height = lngheight
.Width = lngWidth
.FontName = "Times New Roman"
intFSize = .FontSize
If intFSize < intFontSize Then
.FontSize = intFontSize
End If
.FontUnderline = False
.TextAlign = intTextAlign
.BackStyle = intBackStyle
End With
Next

mySection.Controls(lblName(intlbls)).ForeColor = ForeColor

For j = 0 To intlbls - 1
mySection.Controls(lblName(j)).ForeColor = BorderColor
Next

l = intX: t = intY

With mySection.Controls(lblName(4))
.Left = l
.Top = t
End With

For j = 0 To intlbls - 1
With mySection.Controls(lblName(j))
If j = 0 Or j = 3 Then .Left = l - LngI

If j = 1 Or j = 2 Then .Left = l + LngI

If j = 0 Or j = 1 Then .Top = t

If j = 1 Then .Top = t - (0.0104 * 1440)

If j = 0 Then .Top = t + (0.0104 * 1440)

If j = 2 Then .Top = t + LngI

If j = 3 Then .Top = t - LngI

End With
Next
MsgLabel

Border2D_Exit:
Exit Function

Border2D_Err:
MsgBox Err.Description,, "Border2D"
Resume Border2D_Exit
End Function


To Run the Function to create the heading text on a new Form, open the VB Module Window (if not already open) by pressing Alt+F11 then press Ctrl+G to open the Immediate Window (Debug window). Type the following text and press Enter.

Border2D 15,0

The First Parameter is mandatory (Color Value Range 0 – 15) and the 2nd one (Value 0 or 1) is optional. If the Function is called without the first parameter then the Error:

‘Compile Error: Argument Not Optional’ will be displayed.

The first Parameter 15 is for White Border Color and the Second Parameter 0 stands for Label based Heading (if 2nd Parameter is omitted do not use the coma at the end of first parameter). If 1 is used as 2nd Parameter then a TextBox based Heading is created and text will be placed as a Formula in the Control Source Property.

The Module Window will flash a little as if it is refreshed. Minimize the Module Window (with Alt+F11 you can toggle the window) to show up the Database Window and you will see a New Form is Created with the name like Form1 and the Border2D heading is created with a White Border. You can use any color number between 0 to 15. Once the Heading is created you can modify it in several ways.

To change the Heading Text, Text Style, Border Color and Text Color:

Select all the controls together and display the Property Sheet and change the Caption with the Text of your choice. You can make the Text Bold, Italic or change the Size of the Text. Select a Color from the Color Pallette for Border first. This will change the Forecolor of all Labels. Now Click only on the top Label and apply a different Color for Foreground.

--oOo--






Download Demo Database





3D Heading Style
Border 3D Heading Style
Shadow 3D Heading Style

Labels:

0 Comments:

Post a Comment

Note:Comments subject to Review by Blog Author before displaying.

Links to this post:

Create a Link

<< Home

Page Footer

Creative Commons License
Learn MS-Access Tips and Tricks by msaccesstips.com is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 India License.



This Page is best viewed with 1280 x 1024 Resolution

Sidebar Left
   FEATURED LINKS
SITEMAP
Command Button Animation
3D Headings on Forms
MsgBox & Office Assistant
Reminder Ticker
MS-Access & E-Mails
Automated E-Mail Alerts
MsgBox with Options Menu
Colorful Command Buttons
Configure Lotus Notes
Alerts through Network
Running this site has become a costly affair as the revenue from Ads is not sufficient to support it. If you find these pages informative & useful and would like to extend a helping hand, then please do it here.





Link Back to us with this Button

Learn MS-Access

Copy and Paste this HTML Code in your Webpage


Add to Technorati Favorites

Programming Blogs - Blog Catalog Blog Directory
Powered by FeedBurner
Add to Google

Software
Computers blogs
TopOfBlogs



AddMe - Search Engine Optimization Submit Your Site Free!
Go BlogZ Ave Blogs
eBlogzilla Changing LINKS
LS Blogs Blogarama
blog search directory BlogUniverse
Find Blogs in Directory RSS Directory
blogskinny.com ShowcaseBlogs.com
Amfibi

Search Engine Optimization and SEO Tools
Dmegs Web Directory Takeaway for Sale Businesses For Sale
Free Submission Directory Free site submission

Free Listing
 

Sidebar Right Top



Free Page Rank Checker

AddThis Social Bookmark Button

Enter your email address:

Delivered by FeedBurner



Top Blogs

Microsoft Access is the Jewell among MS-Office suite of Applications. Its Security features are excellent and works fine in Network environment. MS-Access can link/upload data from any Data Source. Applications that you design should be user-friendly and visually pleasing too. Here I would like to share my experience in Microsoft Access Programming with you and I am sure that you will find them interesting too.

My Photo
Name: Ramachandran Pillai
Location: Ruwi, Oman


If you need a Demo of any of the Topic explained here, send me an E-mail to: aprpillai@msaccesstips.com
with the Topic Description, I shall try to send a sample database to you.


Sidebar Right Top

Access Tips | Email | Reports | Report Tricks | Graphs | Forms | Menus | Animation | Security | Internet | How TOs | Linking | Query | Progress Meter | Alerts | Process Tips | Access Functions |





Site Designed by:www.msaccesstips.com