MS_Access_Amature
Registered User.
- Local time
- Today, 00:14
- Joined
- Nov 10, 2010
- Messages
- 56
I have a browse button to open up files with the following function on the click event. When I click it it gives me an error message saying - Object doesn't support this property or method. I did a debug and it gives me the error after the red line. Does anybody have any idea what I'm doing wrong?? Please let me know...Thank You!
Code:
Function BrowseCustDATA(sMyControl$)
On Error GoTo MyErrorControl
Dim Result%
With Application.FileDialog(msoFileDialogFolderPicker)
Select Case UCase(Nz(sMyControl, ""))
Case "MYPATH2"
.Title = "Select Network Database"
Dim NtwrkInitialPath As String
NtwrkInitialPath = Nz(Me![MyPath2], "")
If NtwrkInitialPath <> "" Then
If DoesFolderExist(NtwrkInitialPath) = True Then
.InitialFileName = NtwrkInitialPath
ElseIf DoesFileExist(NtwrkInitialPath) = True Then
.InitialFileName = NtwrkInitialPath
Else
.InitialFileName = CurrentProject.Path
End If
Else
.InitialFileName = CurrentProject.Path
End If
Case Else
.Title = "Select Database file"
End Select
' Only ACCDB
[COLOR="Red"] .Filters.Add "All Files", "*.*", 1[/COLOR]
.Filters.Add "Microsoft Office Access", "*.accdb; *.accda; *.accde", 2
.Filters.Add "Microsoft Office Access Databases", "*.accdb", 3
.FilterIndex = 3
.AllowMultiSelect = False
Result = .Show
If (Result <> 0) Then
If Nz(sMyControl, "") <> "" Then
Me(sMyControl) = Trim(.SelectedItems.Item(1))
End If
Select Case UCase(Nz(sMyControl, ""))
Case "MYPATH2"
AfterNetworkCustDATA_Update Nz(Me(sMyControl), "")
End Select
End If
End With
Exit Function
MyErrorControl:
Select Case Err.Number
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical + vbOKOnly, "BrowseCustDATA ERROR"
Exit Function
Resume Next
End Select
End Function