update rows in dbase4 from access tables vba coding

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello.
i want to update some rows in dbase4 file which is location in 'c:\final
directory'. the name of dbase4 file is 'data_final.dbf'.
well i tried to link this file to ms access but cant, as the length of
filename.
however the data_final.dbf contains sum of the data based in ms access tables.
i am trying to do this in vba. can anyone tel me how to link to / make a
connection to dbase file.
 
Hi Maxim,

This VBA function takes an ordinary (long) filespec and returns the
short path to the same file. It seems to work properly but hasn't been
exhaustively tested.


Function GetShortPath(ByVal FileSpec As String, _
Optional FailOnError As Boolean = False)
Dim fso As Object
Dim oFile As Object
Dim oFolder As Object
Dim S As String
Dim Buf As String

On Error GoTo ErrHandler:

Set fso = CreateObject("Scripting.FileSystemObject")
'Get a handle on the file
Set oFile = fso.GetFile(FileSpec)
Do
FileSpec = fso.GetParentFolderName(FileSpec)
If Len(FileSpec) = 0 Then Exit Do
Set oFolder = fso.GetFolder(FileSpec)
Buf = oFolder.ShortName & "\" & Buf
Loop

GetShortPath = oFile.Drive & Buf & oFile.ShortName
Exit Function

ErrHandler:
If FailOnError Then
Err.Raise Err.Number, "GetShortPath()", _
Err.Description & vbCrLf & "[In GetShortPath() function]", _
Err.HelpFile, Err.HelpContext
Else
Err.Clear
GetShortPath = ""
End If
End Function
 
Back
Top