Hii,,
I really need help at this moment with this cod ein access vba for opening a file dialog and selecting a file in a textbox ..
Private Sub Command26_Click()
Dim fDialog As Object
Set fDialog = Application.FileDialog(msoFileDialogOpen)
With fDialog
.AllowMultiSelect = False
.Title = ""
.InitialFileName = ""
If .Show = True Then
For Each varFile In .SelectedItems
GetFileName = varFile
Next
End If
Dim FSO As Object: Set FSO = CreateObject("Scripting.FileSystemObject")
Sheet1.Text29.Text = FSO.GetFileName(Text29.Text)
End With
End Sub
please tell me what is worng with this code,on the form i have a button whose click event is this code and a a text box with it which is text29.
It gives an erro
Run time error '2185':
you cant refernce a propery or method for a control unless the control has the focus .
HElp HELp HElp:banghead:
I really need help at this moment with this cod ein access vba for opening a file dialog and selecting a file in a textbox ..
Private Sub Command26_Click()
Dim fDialog As Object
Set fDialog = Application.FileDialog(msoFileDialogOpen)
With fDialog
.AllowMultiSelect = False
.Title = ""
.InitialFileName = ""
If .Show = True Then
For Each varFile In .SelectedItems
GetFileName = varFile
Next
End If
Dim FSO As Object: Set FSO = CreateObject("Scripting.FileSystemObject")
Sheet1.Text29.Text = FSO.GetFileName(Text29.Text)
End With
End Sub
please tell me what is worng with this code,on the form i have a button whose click event is this code and a a text box with it which is text29.
It gives an erro
Run time error '2185':
you cant refernce a propery or method for a control unless the control has the focus .
HElp HELp HElp:banghead: