Ist euer Problem gelöst, dann bitte den Knopf "Thema gelöst" drücken!
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
ZitatDer Plan ist einen Bericht Automatisch zu Exportieren in html und auf einen bestimmten Pfad zu speichern und das entweder alle 30 sekunden oder wenn in einem Datensatz im Formular eine Änderung vorgenommen wird.Hört sich nicht wirklich wie ein "Plan" an. Auch als "schlimmer VBA Anfänger" solltest du mal die Hintergründe erläutern.
Zitat von: PhilS am Mai 19, 2025, 10:45:21Ich glaube, es sollte funktionieren, wenn du vor Zuweisen der Rowsource das Recordset der ComboBox explizit auf Nothing setzt.Das werde ich so nicht anwenden (Knobbi hat natuerlich recht bzgl. Doppelstrategie), aber es passt ins Bild und die Welt ist wieder heil. Sehr wertvoll.