G
Guest
I have a workorder database resident on a server, with many users, who do
not necessarily have the same drive mappings . My problem is that I need to
import the contents of a text file into a text field on my form. I've scanned
most of the forums, and have come up with some code to do this, but
.......it's not working...keep in mind that I am definitely NOT a programmer
in VB.
Here is the code I'm working with
Function CurrentDBDir() As String
Dim strDBPath As String
Dim strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
CurrentDBDir = Left$(strDBPath, Len(strDBPath) - Len(strDBFile))
End Function
Private Sub ActivityCode_Exit(Cancel As Integer)
If Me.ActivityCode.Value = "H40" Then
Dim strFileSpec As String
strFileSpec = "c:\maint\rb211post.txt"
((((need to replace 'c:\maint' with the result of determining the actual
directory where the database resides))))) If I substitute c:\maint with
CurrentDBDir I get an error on the next statement. otherwise the private sub
activity code works, cuz my test database is local to my hard drive.
Me.problem.Value = FileContents(strFileSpec, True)
End If
End Sub
not necessarily have the same drive mappings . My problem is that I need to
import the contents of a text file into a text field on my form. I've scanned
most of the forums, and have come up with some code to do this, but
.......it's not working...keep in mind that I am definitely NOT a programmer
in VB.
Here is the code I'm working with
Function CurrentDBDir() As String
Dim strDBPath As String
Dim strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
CurrentDBDir = Left$(strDBPath, Len(strDBPath) - Len(strDBFile))
End Function
Private Sub ActivityCode_Exit(Cancel As Integer)
If Me.ActivityCode.Value = "H40" Then
Dim strFileSpec As String
strFileSpec = "c:\maint\rb211post.txt"
((((need to replace 'c:\maint' with the result of determining the actual
directory where the database resides))))) If I substitute c:\maint with
CurrentDBDir I get an error on the next statement. otherwise the private sub
activity code works, cuz my test database is local to my hard drive.
Me.problem.Value = FileContents(strFileSpec, True)
End If
End Sub