Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browse Button VB Code Problem

Status
Not open for further replies.

TrevorAaron

Technical User
Jun 22, 2012
10
US
Hello Everyone,

I've been struggling with a VB error I keep getting. The error is a "Compile Error: Method or data not found".

I found the code on an old thread here.

Here's the link:
I'm trying to do the same thing as what says in the post, place a browse button on a form in access so that the user can open and select from a bunch of files locally and copy the path of the filename and place it into a text box to select later. I copied the code and updated the references to the appropriate names. Here's my code:

Code:
Private Sub cmdBrowse_Click()

Dim VFile As String

On Error GoTo cmdBrowse_Click_Err
  
  ChDrive ("S")
ChDir ("S:\")
  txtOximeterReport.Filter = "All Files (*.*)|*.*|txtOximeterReport.FilterIndex = 1"
  txtOximeterReport.FilterIndex = 1
 txtOximeterReport.Action = 1
 
  If txtOximeterReport.FileName <> "" Then
      VFile = txtOximeterReport.FileName
      Me!lbldb = VFile
  End If
cmdBrowse_Click_Exit:
Exit Sub

cmdBrowse_Click_Err:
MsgBox Err.Description, , "cmdBrowse_Click"
Resume cmdBrowse_Click_Exit


End Sub

The error highlights on the first ".filter =". I have a text box named "txtOximeterReport". My button is named "cmdBrowse". The event procedure is placed in "On Click". I've tried searching all over the web on how to solve this error and haven't found anything. Am I referencing incorrectly?
 
>txtOximeterReport.Filter = "All Files (*.*)|*.*|txtOximeterReport.FilterIndex = 1"

txtOximeterReport.Filter = "All Files (*.*)|*.*"

 
Thanks StrongM

I made the change but the error is still there. It resides again on the first ".Filter ="

thanks.
 
Thanks for the help but it turns out my company doesn't need this feature anymore. I'm rather surprised MS Access didn't make this a central feature in their 2010 version. I would think I'm not the only person who wants this as a feature in the database. Oh well. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top