Wenn ihr euch für eine gute Antwort bedanken möchtet, im entsprechenden Posting einfach den Knopf "sag Danke" drücken!
ZitatVerwenden Sie False (0), um die erste Zeile der Textdatei als normale Daten zu behandeln. Wenn Sie dieses Argument leer lassen, wird der Standard (False) angenommen.Und das gilt auch beim Export.
DoCmd.TransferText acImportDelim, "servicecatalog", "servicecatalog_rohimport", SC_Datei, True
(Der Variablen SC_Datei ist vorher der Dateiname zugewiesen worden)DoCmd.TransferText TransferType:=acExportDelim, _
SpecificationName:="servicecatalog", _
TableName:="servicecatalog_export", _
FileName:=Ordner & "\sc.csv", _
HasFieldNames:=True, _
Codepage:=65001
(Ich habe auf die Schreibweise mit benannten Parametern umgestellt nachdem das Problem auftrat, aber das ändert nichts)https://www.vbforums.com/showthread.php?851223-LDB-Viewer
https://www.manageengine.de/produkte-loesungen/active-directory/adaudit-plus/infomaterial/ad-tipp-datei-und-ordnerzugriffe-ueberwachen.html
oder aber mit Tools aus den Powertoys:https://www.windows-faq.de/2022/11/13/wer-hat-diese-datei-im-zugriff/
Public Function WhosOn(BEPfad As String) As String
On Error GoTo Err_WhosOn
Dim iLDBFile As Long, iStart As Long
Dim iLOF As Long, i As Long
Dim X As String
Dim sLogStr As String, sLogins As String
Dim sMach As String, sUser As String
Dim rUser As UserRec
X = Dir(BEPfad)
iStart = 1
iLDBFile = FreeFile
Open BEPfad For Binary Access Read Shared As iLDBFile
iLOF = LOF(iLDBFile)
Do While Not EOF(iLDBFile)
Get iLDBFile, , rUser
With rUser
i = 1
sMach = ""
While .bMach(i) <> 0
sMach = sMach & Chr(.bMach(i))
i = i + 1
Wend
i = 1
sUser = ""
While .bUser(i) <> 0
sUser = sUser & Chr(.bUser(i))
i = i + 1
Wend
End With
sLogStr = sMach
If InStr(sLogins, sLogStr) = 0 Then
sLogins = sLogins & sLogStr & "; "
End If
iStart = iStart + 64
Loop
Close iLDBFile
WhosOn = sLogins
Exit_WhosOn:
Exit Function
Err_WhosOn:
If Err = 68 Then
MsgBox "Ich finde keine LDB-Liste", 48, "No LDB File"
Else
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
Close iLDBFile
End If
Resume Exit_WhosOn
End Function
sPath = CurrentDb.Name
Und wenn schon eine Referenz, dann besser soPrivate m_dbCurrent As DAO.Database
Public Property Get dbCurrent() As DAO.Database
'---------------------------------------------------------------------------------------
' Autor : Hab' ich mal wieder vergessen; schätze aber Lebans oder Kreft
' Purpose : Why is this the "CurrentDbC" property proc best? Because it is the
' most generic and handles the most issues and problems. After all, a
' global can be erased if someone hits the code reset button in VBE.
' DBEngine(0)(0) might not be the current db. CurrentDb is expensive if
' called repeatedly. And so on.
'---------------------------------------------------------------------------------------
If (m_dbCurrent Is Nothing) Then
Set m_dbCurrent = CurrentDb
End If
Set dbCurrent = m_dbCurrent
Ende_CleanUp:
On Error Resume Next
Exit Property
End Property
Public Function WhosOn(BEPfad As String) As String
On Error GoTo 0 'Err_WhosOn
Dim iLDBFile As Integer, iStart As Integer
Dim iLOF As Integer, i As Integer
Dim sPath As String, X As String
Dim sLogStr As String, sLogins As String
Dim sMach As String, sUser As String
Dim rUser As UserRec
Dim dbCurrent As Database
Set dbCurrent = DBEngine.Workspaces(0).Databases(0)
sPath = dbCurrent.Name
dbCurrent.Close
X = Dir(BEPfad)
iStart = 1
iLDBFile = FreeFile
Open BEPfad For Binary Access Read Shared As iLDBFile
iLOF = LOF(iLDBFile)
Do While Not EOF(iLDBFile)
Get iLDBFile, , rUser
With rUser
i = 1
sMach = ""
While .bMach(i) <> 0
sMach = sMach & Chr(.bMach(i))
i = i + 1
Wend
i = 1
sUser = ""
While .bUser(i) <> 0
sUser = sUser & Chr(.bUser(i))
i = i + 1
Wend
End With
sLogStr = sMach
If InStr(sLogins, sLogStr) = 0 Then
' sLogins = sLogins & WerTippt(sLogStr) & vbCrLf '"; "
sLogins = sLogins & sLogStr & "; "
End If
iStart = iStart + 64
Loop
Close iLDBFile
WhosOn = sLogins
Set dbCurrent = Nothing
Exit_WhosOn:
Exit Function
Err_WhosOn:
If Err = 68 Then
MsgBox "Ich finde keine LDB-Liste", 48, "No LDB File"
Else
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
Close iLDBFile
End If
Resume Exit_WhosOn
End Function