Domino 9 und frühere Versionen > ND8: Entwicklung
Database xy has not been opend yet
koehlerbv:
Code?
tabama:
Option Public
Option explicit
Dim db As NotesDatabase
Dim dbVA As NotesDatabase
Dim dc As NotesDocumentCollection
Dim dcVA As NotesDocumentCollection
Dim doc As NotesDocument
Dim docVA As NotesDocument
Dim query As String
Dim pn As String
Dim ts As String
Dim te As String
Sub Initialize
Dim session As New NotesSession
Set db = session.CurrentDatabase
Set dbVA = session.GetDatabase("", "Vertragsabrechnung")
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
Call haupt
End Sub
Sub haupt
pn = CStr(doc.pn(0))
ts = Left(CStr(doc.TxTSLEinzelauftrag(0)),2)
te = Right(CStr(doc.TxTSLEinzelauftrag(0)),2)
query = |form = 'HUM' & HU_PN_v <= | + pn + | & HU_PN_b >= | + pn + | & HU_TS_v <= | + ts + | & HU_TS_b >= | + ts + | & HU_TE_v <= | + te + | & HU_TE_b >= | + te
Set dcVA = dbVA.Search(query, Nothing, 0)
If dcVA.count = 0 Then
doc.UmsatzGrp = "15 = Sonstige"
ElseIf dcVA.count > 1 Then
' MessageBox "F E H L E R, bitte Admin verständigen", MB_OK, "Umsatzgruppe"
Else
Set docVA = dcVA.GetFirstDocument
doc.UmsatzGrp = docVA.HU_UgpNa(0)
End If
End Sub
dnotes:
Hast Du Dir den querystring mal anzeigen lassen? Vielleicht stimmt damit ja etws nicht.
tabama:
Hallo,
das query stimmt, da ich es 1:1 aus eine script heraus kopiert habe, wo es funktioniert. Ich habe das Ganze nämlich erst in der Original-DB getestet.
koehlerbv:
Eine falsche Query gibt entweder Formula-Gemecker oder eben keine Resultate.
Ausreichenden Zugriff auf die DB hast Du bzw. die ausführende ID?
By the way: Du führst mit NotesDatabase.Search keine Volltextsuche aus, Martin.
Bernhard
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln