FlowFact - Entwicklungstools v19.881 FLOWFACT 2017 R2 - Function - Det_SetOptionDsn

Detailoption setzen

Function Det_SetOptionDsn(ByVal strTable As String, ByVal strTableDsn As String, ByVal strFldArtDsn As String, ByVal strValue As String, Optional ByVal strAcl As String = STRNOTHING) As Boolean


strTable: Tabellenname der Haupttabelle
strTableDsn: Datensatznummer der Haupttabelle z.B. AD, Obj ...
strFldArtDsn: Die Datensatznummer (DSN) der FeldArt
strValue: Die Datensatznummer (DSN) der Option
OPTIONAL strACL: Berechtigung (siehe EMSK_GetDefaultACL)


Public Function Det_SetOptionDsn(ByVal strTable As String, ByVal strTableDsn As String, ByVal strFldArtDsn As String, ByVal strValue As String, Optional ByVal strAcl As String = STRNOTHING) As Boolean
    Dim bResult As Boolean
    Dim rs As ADODB.Recordset
    Dim strSQL As String
    Dim strTblDet As String

    bResult = False

    strTblDet = UCase(strTable) & "DET"
    If strValue <> "" And strFldArtDsn <> "" And strTable <> "" And strTableDsn <> "" Then
        'Immer über Haupttabelle auf Det-Tabelle zugreifen, wg. Berechtigung
        'Bei mehrfachen Detail-Felder wird das erste in der Tabelle genommen (Sortierung nach DSN)
        strSQL = "SELECT " & strTblDet & ".* " & _
                  "FROM " & strTable & " INNER JOIN " & strTblDet & " ON " & strTable & ".dsn = " & strTblDet & "." & strTable & "_dsn " & _
                  "WHERE (" & strTable & ".DSN=" & m_oUtil.SqlUid(strTableDsn) & ") AND (" & strTblDet & ".FLDART_DSN=" & m_oUtil.SqlUid(strFldArtDsn) & ") " & _
                  "ORDER BY " & strTblDet & ".DSN"
        Set rs = FF_GetRecordset(strSQL)
        If rs.EOF = True Then
            rs.AddNew
            rs("DSN").value = m_oUtil.NewGUID()
            rs(strTable & "_DSN").value = strTableDsn
            rs("FldArt_DSN").value = strFldArtDsn
        Else
            rs("Eingabe").value = Null
            rs("von_str").value = Null
            rs("bis_str").value = Null
            rs("von_num").value = 0
            rs("bis_num").value = 0
            rs("Link_DSN").value = Null
        End If

        If strAcl <> STRNOTHING Then
            rs("ACL").value = strAcl
        End If

        rs("FldArtOp_Dsn").value = m_oUtil.SqlStrNull(strValue)


        FF_UpdateRecordset rs
        bResult = True

        Set rs = Nothing
    End If
    Det_SetOptionDsn = bResult
End Function