How to use the Command dialog box API in Access 2003 or Access 2007 years database

Source: Internet
Author: User
Tags chr integer mdb database modify

INTRODUCTION

This guide describes how to replace is included with Microsoft Office XP Developer Edition only in Microsoft Office Developer Edition or Common dialog box features at Microsoft Offic E Access 2003 or Microsoft Office Access 2007-Year common dialog box API.

More information

Microsoft provides programming examples only, for illustrations without any express or implied reference. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools that are being used to debug the process to create and use. Microsoft support engineers can help explain specific procedures for functionality, but they will modify these samples to provide added functionality or build processes to meet specific requirements. Steps to replace the common dialog box feature Microsoft Office Access 2003

1. In Access, open the sample database named Northwind.mdb. Note Access 2003 the Northwind.mdb database is typically located in the C:\ProgramFiles\Common Files office\office11\samples folder.
2. In the Northwind Database window, the object clicks the form
3. On the Database window toolbar, click New.
4. dialog box, in a new form, click, Design view, and then click OK.
5. Add a text box to Form 1, right-click the text box, and then click Properties.
6. Click the all tabs, click the name, type Text 1, and close the Properties dialog box.
7. Right-click the label control to be associated with textbox Text 1, attributes, and then all tabs.
8. Click the title, type Text 1, and then close the Properties dialog box.
9. Add a command button to Form 1, right-click the command button, click Properties, click the name, type command, click Caption, and then type command.
10. Click the Events tab, click the On click List, [Event Procedure], and then click the ellipsis button to start the Microsoft Visual Basic Editor.
11. Modify the code with the following Command 1 _ Click procedure: Private Sub Command1_Click () me! Text1 = LAUNCHCD (Me) End Sub
12. On the Insert menu, click the module, and then insert the following code into Module 1:
Private Declare Function getopenfilename Lib "Comdlg32.dll" Alias _ "Getopenfilenamea" (Popenfilename as OpenFileName) as Long Private Type openfilename lstructsize as Long hwndowner as long hinstance as Long Lpstrfilter as String LP Strcustomfilter As String nmaxcustfilter as Long nfilterindex as Long lpstrfile as String nmaxfile as Long LPSTR Filetitle As String nmaxfiletitle as Long lpstrInitialDir as String lpstrtitle As String flags as Long nfileoffs Et as Integer nfileextension as Integer lpstrdefext as String lcustdata as Long lpfnhook as Long lptemplatename As String end Type Function launchcd (strform as Form) as String Dim openfile As OpenFileName Dim lreturn As Long Dim Sfilter as String openfile.lstructsize = Len (openfile) Openfile.hwndowner = Strform.hwnd sfilter = "All Files (*.*) "& Chr (0) &" *.* "& Chr (0) & _" JPEG Files (*. JPG) "& Chr (0) &" *.  JPG "& Chr (0) Openfile.lpstrfilter = sfilter Openfile.nfilterindex = 1 Openfile.lpstrfile = String (257, 0) Openfile.nmaxfile = Len (openfile.lpstrfile)-1 OpenF   Ile.lpstrfiletitle = Openfile.lpstrfile Openfile.nmaxfiletitle = openfile.nmaxfile OpenFile.lpstrInitialDir = "C:\" Openfile.lpstrtitle = "Select a file using the Common Dialog DLL" openfile.flags = 0 lreturn = GetOpenFileName (openfil e) If lreturn = 0 Then MsgBox "A file is not selected!", vbinformation, _ "Select a" file using the Commo      n Dialog DLL "Else LAUNCHCD = Trim (left (Openfile.lpstrfile, InStr (1, Openfile.lpstrfile, vbNullChar)-1)" End If End Function
13. On the Debug menu, click Compile Northwind, and then close the VisualBasic editor.
14. On the View menu, click Form View.
15. Command to open a file in the window in turn. The file path that is displayed in the Text 1 textbox.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.