Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

Using a browse button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rjw24 - 20 Jun 2007 10:56 GMT
I have attempted to use the code supplied on
http://www.mvps.org/access/api/api0001.htm and as I have limited knowledge of
VBA have found it a bit confusing. The Issue I have however, is that how do I
link this code to a button, I have completed usual practice of using the 'on
click' event in the properties but this requires the use of a sub rather than
a function. Please advise.

Thanks
scubadiver - 20 Jun 2007 11:29 GMT
Copy the code in the light blue box into a new module and save it with
whatever name you like.

In the "on click" event insert the following:

On Error GoTo Err_txtDocs_DblClick
Dim strFilter As String
Dim lngFlags As Long
Dim DocPath As String

   strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
   'MsgBox "You selected: " &
    DocPath = ahtCommonFileOpenSave(InitialDir:="C:\", _
       Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
       DialogTitle:="Select Document")
   
   If Not DocPath = "" Then
       Me.AttDoc = DocPath
   End If
Exit_txtDocs_DblClick:
   Exit Sub

Err_txtDocs_DblClick:
   MsgBox Err.Description
   Resume Exit_txtDocs_DblClick

Create a text box called "AttDoc" (mine is bound) and whatever file you
choose will go into the field.

It does for me anyway.
Douglas J. Steele - 20 Jun 2007 11:31 GMT
What you do is copy everything between Code Start and Code End into a new
module (make sure it's not a class module nor the module associated with a
form. Also make sure when you save it that the name of the module isn't the
same as any of the functions or subs within the module)

Now, in the Click event of your button, put code similar to the 4 lines of
code at the top of the page.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I have attempted to use the code supplied on
> http://www.mvps.org/access/api/api0001.htm and as I have limited knowledge
[quoted text clipped - 8 lines]
>
> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.