Microsoft KB Archive/95932

= ACC: How to Change the &quot;Microsoft Access&quot; Window Caption 1.x/2.0 =

Article ID: 95932

Article Last Modified on 5/9/2003

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition

-



This article was previously published under Q95932



SUMMARY
Advanced: Requires expert coding, interoperability, and multiuser skills.

Microsoft Access does not have property to set the main caption of the Microsoft Access window. To change the default &quot;Microsoft Access&quot; caption to your own text, you must call the Windows application programming interface (API) SetWindowText function.



MORE INFORMATION
To change the default &quot;Microsoft Access&quot; caption to your own text string, create a new module in Microsoft Access and add the following function with the appropriate declaration section.

NOTE: You may have some Microsoft Windows API functions defined in an existing Microsoft Access library; therefore, your declarations may be duplicates. If you receive a duplicate procedure name error message, remove or comment out the declarations statement in your code.

NOTE: In the following sample code, an underscore (_) is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.

     '- ' GLOBAL DECLARATION '-     Option Compare Database Option Explicit Declare Function FindWindow% Lib &quot;User&quot; (ByVal lpClassName As Any, _                         ByVal lpWindowName As Any) Declare Sub SetWindowText Lib &quot;User&quot; (ByVal hWnd%, ByVal lpString$)

'-     ' Function: SetCaption ' This function will set the caption of     ' Microsoft Access's main window. '-     Function SetCaption Dim hWnd% hWnd% = FindWindow%(&quot;OMain&quot;, 0&) Call SetWindowText(hWnd%, &quot;This is cool!&quot;) End Function

To change the caption when Microsoft Access starts, you can run the RunCode macro action with SetCaption as an argument and save the macro as AutoExec. When you open this database, this macro will run and change the &quot;Microsoft Access&quot; caption to &quot;This is cool!&quot;

