Når jeg åbner databasen får jeg følgende oplysning i en msgbox:
Microsoft Access can't find the macro 'SattlineSearcher.'
The macro (or its macro group) doesn't exist, or the macro is new but hasn't been saved. Note that when yue enter the macrogroupname.macroname syntax in an argument, you must specify the name the macro's macro group was last saved under.
Den eneste makro jeg har er jo AutoExec og den har jeg gemt!
Med version 7 af TeamShare tager Lector næste skridt og bygger en platform for AI-agenter, der i højere grad kan følge medarbejderen gennem hele arbejdsprocessen.
Der er ingen events som peger på AutoExec. Det eneste AutoExec gør et at den kalder en function Startup som kalder en Sub som kalder en anden Sub.
'******************************************************************************************** 'This function is called from the function Startup and makes a raw copy of the content of the 'Journalfile into the JourInfoLink. ' 'ver. 001 RMun 2002-09-04 '********************************************************************************************
Public Sub OpenFile() On Error GoTo ErrHandler
'Declaration of variables Dim strSQL As String
DoCmd.Hourglass True DoCmd.SetWarnings False 'Delete existing table JourInfoLink DoCmd.DeleteObject acTable, "JourInfoLink" 'Makes a linked table - JourInfoLink - to the journalfile DoCmd.TransferText acLinkFixed, "Jouinfo Link Specification", "JourInfoLink", cStrPath strSQL = "SELECT JourInfoLink.* INTO JournalInfo FROM JourInfoLink;" 'Transfers all data from the table JourInfoLink to the table JournalInfo DoCmd.RunSQL strSQL DoCmd.SetWarnings True 'Calls the procedure SearchJournalInfo SearhJournalInfo DoCmd.Hourglass False Exit Sub
ErrHandler: MsgBox Err.Description Exit Sub
End Sub
'******************************************************************************************** 'This procedure is called from the function Openfile. It runs through the journalfile and 'fetches all relevant information. ' 'ver. 001 RMun 2002-09-04 '********************************************************************************************
Public Sub SearhJournalInfo() On Error GoTo ErrHandler
'Declaration of variables Dim con As ADODB.Connection Dim rstJournalInfo As ADODB.Recordset Dim rstTagData As ADODB.Recordset Dim strOccuranceTime As String Dim strTagName As String Dim strSQL As String
Set rstJournalInfo = New ADODB.Recordset Set rstTagData = New ADODB.Recordset Set con = New ADODB.Connection
'Indicates the name of the provider for the con object con.Provider = "Microsoft.Jet.OLEDB.4.0" 'Opens the connection con.Open CurrentDb.Name, "admin", ""
DoCmd.SetWarnings False strSQL = "DELETE TagData.* FROM TagData;" 'Empties the table TagData DoCmd.RunSQL strSQL DoCmd.SetWarnings True
'Makes a recordset based on the table JournalInfo rstJournalInfo.Open "JournalInfo", con, adOpenKeyset, adLockOptimistic 'Makes another recordset based on the empty table TabData rstTagData.Open "TagData", con, adOpenKeyset, adLockOptimistic, adCmdTable
'Run through the table JournalInfo untill the string "Occurancetime:" is met Do Until Left(rstJournalInfo!Field1, 14) = "OccuranceTime:" rstJournalInfo.MoveNext Loop
Do Until rstJournalInfo.EOF If Left(rstJournalInfo!Field1, 14) = "OccuranceTime:" Then 'If "OccuranceTime:" is met store the logTime in strOccuranceTime strOccuranceTime = Trim$(Right(rstJournalInfo!Field1, 25)) End If If Left(rstJournalInfo!Field1, 8) = "TagName:" Then 'Add a new record to rstTagData Alias table TagData rstTagData.AddNew 'If "TagName:" is met store the tagname in strTagName strTagName = Mid(Trim$(Mid(rstJournalInfo!Field1, 9)), 2) 'Insert TagName and LogTime in table TagData rstTagData!TagName = Trim$(Mid(strTagName, 1, InStr(1, strTagName, " "))) rstTagData!LogTime = strOccuranceTime If strOccuranceTime <> "" Then 'Insert Time in format #DD-MM-YYYY HH:MM:SS# in TagData rstTagData!Time = Format(CDate(Left(strOccuranceTime, Len(strOccuranceTime) - 4)), "DD-MM-YYYY HH:MM:SS") End If End If 'If "ValueSpecification:" is met enter IF Statement If Left(rstJournalInfo!Field1, 19) = "ValueSpecification:" Then 'Insert Value in table TagData rstTagData!Value = Trim$(Mid(rstJournalInfo!Field1, 20)) If InStr(1, rstTagData!Value, Chr(34)) <> 0 Then 'If " is present in value cut it of and insert the updated value rstTagData!Value = Trim$(Mid(rstTagData!Value, InStr(1, rstTagData!Value, Chr(34)) + 1)) End If If Right(rstTagData!Value, 1) = ")" Then 'If ) is present in value cut it of and insert the updated value rstTagData!Value = Trim$(Mid(rstTagData!Value, 1, InStr(1, rstTagData!Value, Chr(34)) - 1)) 'Row in table TagData is only committed if value is detected rstTagData.Update End If End If
rstJournalInfo.MoveNext Loop
rstJournalInfo.Close con.Close Exit Sub
ErrHandler: MsgBox Err.Description Exit Sub
End Sub
'******************************************************************************************** 'This function is called from the macro AuteExec which fires when the SattlineSearcher.mde file 'is opened. Furthermore it calls other functions that transfers information from the Sattline 'Journalfile to SattlineSeacher ' 'ver. 001 RMun 2002-09-04 '********************************************************************************************
Public Function Startup() On Error GoTo ErrHandler
'Declaration of variables Dim objFs As Object
'Prompts the user to place the Journalfile i c:\ and rename it to journalfile.txt MsgBox "Place the extractionfile from Sattline in c:\ and rename it to journalfile.txt!", , "SattlineSearcher"
Set objFs = CreateObject("Scripting.FileSystemObject") If objFs.FileExists(cStrPath) Then 'If the user have applied the requirements in the msgbox the system will call the 'function OpenFile. MsgBox "After pressing OK SattlineSearcher will analyse the journalfile, " & vbCrLf & _ "which can take som minutes. Please be patient!", , "SattlineSearcher" OpenFile DoCmd.OpenForm "frmTextSearch", acNormal, , , , acWindowNormal DoCmd.Maximize Form_frmTextSearch.cmdShowAll_Click Else 'If the user does not do as specified in msgbox, the startup function will call 'itself and the user will be prompted with the same msgbox again. The system will 'keep on doing so untill the requirements in the msgbox are met. Set objFs = Nothing Startup End If
Set objFs = Nothing Exit Function
ErrHandler: MsgBox Err.Description Exit Function
End Function
Som det fremgår kalder Startup også følgende event:
Public Sub cmdShowAll_Click() On Error GoTo Err_cmdShowAll_Click
'Declaration of variables Dim strSQL As String Dim con As ADODB.Connection Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset Set con = New ADODB.Connection
'Indicates the name of the provider for the con object con.Provider = "Microsoft.Jet.OLEDB.4.0" 'Opens the connection con.Open CurrentDb.Name, "admin", ""
strSQL = "SELECT Min(TagData.Time) AS StartTime, Max(TagData.Time) AS StopTime FROM TagData;" 'Open recordset which holds the first and last logged time in the tabel TagData rst.Open strSQL, con, adOpenKeyset, adLockOptimistic
'Set SQL string to specify all tags fra TagData strSQL = "SELECT DISTINCT TagData.TagName FROM TagData;" 'Update listbox lstTags.RowSource = strSQL
'Set SQL string to specify all records in the table TagData strSQL = "SELECT TagData.TagName, TagData.LogTime, TagData.Value, TagData.Time " & _ "FROM TagData WHERE " & _ "(TagData.Time) Between [Forms]![frmTextSearch]![txtStartTime] And " & _ "[Forms]![frmTextSearch]![txtStopTime]" & _ "ORDER BY TagData.TagName, TagData.LogTime;"
Go into your startup options, you have SattlineSearcher set in as variuos paramaters, also as a startup menu which doesn’t exist. I have removed all of these and it works now!
Det er rigtigt! På et tidspunkt sad jeg og rodede med noget menu, som jeg så droppede. Jeg har nu ændret boksene til default og det spiller. Og ja, vi kan kun blive enige om at fejlbeskeden er vildledende.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.