<%
'
'    Filename: fac_userraprecord.asp
'    Generated with CodeCharge 2.0.5
'    ASP 2.0 & Templates.ccp build 11/30/2001
'

'-------------------------------
' 
' fac_userraprecord CustomIncludes Event begin
%>
<!-- #INCLUDE FILE="Common.asp" -->
<%
' fac_userraprecord CustomIncludes Event end


'===============================
' Save Page and File Name available into variables
'-------------------------------
sFileName = "fac_userraprecord.asp"
sTemplateFileName = "fac_userraprecord.html"
'===============================


'===============================
' fac_userraprecord PageSecurity begin
' fac_userraprecord PageSecurity end
'===============================

'===============================
' fac_userraprecord Open Event begin
' fac_userraprecord Open Event end
'===============================

'===============================
' fac_userraprecord OpenAnyPage Event begin
' fac_userraprecord OpenAnyPage Event end
'===============================

'===============================
'Save the name of the form and type of action into the variables
'-------------------------------
sAction = GetParam("FormAction")
sForm = GetParam("FormName")
'===============================

' fac_userraprecord Show begin
'===============================
' Perform the form's action
'-------------------------------
' Initialize error variables
'-------------------------------
sUserrapRecordErr = ""

'-------------------------------
' Select the FormAction
'-------------------------------
Select Case sForm
  Case "UserrapRecord"
    UserrapRecordAction(sAction)
end select
'===============================

'===============================
' Display page
'-------------------------------
' Load HTML template for this page
'-------------------------------
LoadTemplate sAppPath & sTemplateFileName, "main"
'-------------------------------
' Load HTML template of Header and Footer
'-------------------------------
'-------------------------------
SetVar "FileName", sFileName


'-------------------------------
' Step through each form
'-------------------------------
UserrapRecord_Show
'-------------------------------
' Process page templates
'-------------------------------
Parse "main", False
'-------------------------------
' Output the page to the browser
'-------------------------------
Response.write PrintVar("main")

' fac_userraprecord Show end

'-------------------------------
' Destroy all object variables
'-------------------------------

' fac_userraprecord Close Event begin
' fac_userraprecord Close Event end

cn.Close
Set cn = Nothing
UnloadTemplate
'===============================
'===============================
' Action of the Record Form
'-------------------------------
Sub UserrapRecordAction(sAction)
'-------------------------------
' Initialize variables  
'-------------------------------
  Dim bExecSQL: bExecSQL = true
  Dim sActionFileName : sActionFileName = ""
  Dim sParams : sParams = "?"
  Dim sWhere : sWhere = "" 
  Dim bErr : bErr = False
  Dim pPKFAC_USRRAP_KEY : pPKFAC_USRRAP_KEY = ""
  Dim fldFAC_USRRAP_OMSCHRIJVING : fldFAC_USRRAP_OMSCHRIJVING = ""
  Dim fldFAC_USRRAP_VIEW_NAME : fldFAC_USRRAP_VIEW_NAME = ""
  Dim fldFAC_USRRAP_INFO : fldFAC_USRRAP_INFO = ""
  Dim fldFAC_USRRAP_IN_HUIDIGE_LOCATIE : fldFAC_USRRAP_IN_HUIDIGE_LOCATIE = ""
  Dim fldFAC_USRRAP_AANMAAK : fldFAC_USRRAP_AANMAAK = ""
  Dim fldFAC_USRRAP_TEMPLATE : fldFAC_USRRAP_TEMPLATE = ""
  Dim fldFAC_USRRAP_MACRO : fldFAC_USRRAP_MACRO = ""
  Dim fldFAC_USRRAP_VRAAGBEGINDATUM : fldFAC_USRRAP_VRAAGBEGINDATUM = ""
  Dim fldFAC_USRRAP_VRAAGEINDDATUM : fldFAC_USRRAP_VRAAGEINDDATUM = ""
  Dim fldFAC_USRRAP_FUNCTIE : fldFAC_USRRAP_FUNCTIE = ""
  Dim fldFAC_FUNCTIE_KEY : fldFAC_FUNCTIE_KEY = ""
  Dim fldFAC_USRRAP_AUTOREFRESH : fldFAC_USRRAP_AUTOREFRESH = ""
'-------------------------------

'-------------------------------
' UserrapRecord Action begin
'-------------------------------
  sActionFileName = "fac_userrapgrid.asp"
  sParams = sParams & "sFAC_USRRAP_OMSCHRIJVING=" & ToURL(GetParam("Trn_sFAC_USRRAP_OMSCHRIJVING")) & "&"
  sParams = sParams & "sFAC_USRRAP_VIEW_NAME=" & ToURL(GetParam("Trn_sFAC_USRRAP_VIEW_NAME"))

'-------------------------------
' CANCEL action
'-------------------------------
  if sAction = "cancel" then

'-------------------------------
' UserrapRecord BeforeCancel Event begin
' UserrapRecord BeforeCancel Event end
'-------------------------------
    cn.Close
    Set cn = Nothing
    response.redirect sActionFileName & sParams
  end if
'-------------------------------

'-------------------------------
' Build WHERE statement
'-------------------------------
  if sAction = "update" or sAction = "delete" then
    pPKFAC_USRRAP_KEY = GetParam("PK_FAC_USRRAP_KEY")
    if IsEmpty(pPKFAC_USRRAP_KEY) then exit sub
    sWhere = "FAC_USRRAP_KEY=" & ToSQL(pPKFAC_USRRAP_KEY, "Number")
  end if
'-------------------------------


'-------------------------------
' Load all form fields into variables
'-------------------------------
  fldFAC_USRRAP_OMSCHRIJVING = GetParam("FAC_USRRAP_OMSCHRIJVING")
  fldFAC_USRRAP_VIEW_NAME = GetParam("FAC_USRRAP_VIEW_NAME")
  fldFAC_USRRAP_INFO = GetParam("FAC_USRRAP_INFO")
  fldFAC_USRRAP_IN_HUIDIGE_LOCATIE = GetParam("FAC_USRRAP_IN_HUIDIGE_LOCATIE")
  fldFAC_USRRAP_AANMAAK = GetParam("FAC_USRRAP_AANMAAK")
  fldFAC_USRRAP_TEMPLATE = GetParam("FAC_USRRAP_TEMPLATE")
  fldFAC_USRRAP_MACRO = GetParam("FAC_USRRAP_MACRO")
  fldFAC_USRRAP_VRAAGBEGINDATUM = GetParam("FAC_USRRAP_VRAAGBEGINDATUM")
  fldFAC_USRRAP_VRAAGEINDDATUM = GetParam("FAC_USRRAP_VRAAGEINDDATUM")
  fldFAC_USRRAP_FUNCTIE = GetParam("FAC_USRRAP_FUNCTIE")
  fldFAC_FUNCTIE_KEY = GetParam("FAC_FUNCTIE_KEY")
  fldFAC_USRRAP_AUTOREFRESH = getCheckBoxValue(GetParam("FAC_USRRAP_AUTOREFRESH"), "1", "0", "Number")

'-------------------------------
' Validate fields
'-------------------------------
  if sAction = "insert" or sAction = "update" then
    if IsEmpty(fldFAC_USRRAP_OMSCHRIJVING) then
      sUserrapRecordErr = sUserrapRecordErr & "De waarde in veld Omschrijving is verplicht.<br>"
    end if
    if IsEmpty(fldFAC_USRRAP_VIEW_NAME) then
      sUserrapRecordErr = sUserrapRecordErr & "De waarde in veld Viewname is verplicht.<br>"
    end if
    if not isNumeric(fldFAC_USRRAP_VRAAGBEGINDATUM) then
      sUserrapRecordErr = sUserrapRecordErr & "De waarde in veld FAC_USRRAP_VRAAGBEGINDATUM is niet correct.<br>"
    end if
    if not isNumeric(fldFAC_USRRAP_VRAAGEINDDATUM) then
      sUserrapRecordErr = sUserrapRecordErr & "De waarde in veld FAC_USRRAP_VRAAGEINDDATUM is niet correct.<br>"
    end if
    if not isNumeric(fldFAC_USRRAP_FUNCTIE) then
      sUserrapRecordErr = sUserrapRecordErr & "De waarde in veld Styling optie is niet correct.<br>"
    end if
    if not isNumeric(fldFAC_FUNCTIE_KEY) then
      sUserrapRecordErr = sUserrapRecordErr & "De waarde in veld Autorisatie als is niet correct.<br>"
    end if
'-------------------------------
' UserrapRecord Check Event begin
' UserrapRecord Check Event end
'-------------------------------
    If len(sUserrapRecordErr) > 0 then
      exit sub
    end if
  end if
'-------------------------------


'-------------------------------
' Create SQL statement
'-------------------------------
  select case sAction
    case "insert"
'-------------------------------
' UserrapRecord Insert Event begin
sSQL = "insert into FAC_USRRAP (" & _
          "FAC_USRRAP_OMSCHRIJVING," & _
          "FAC_USRRAP_VIEW_NAME," & _
          "FAC_USRRAP_INFO," & _
          "FAC_USRRAP_IN_HUIDIGE_LOCATIE," & _
          "FAC_USRRAP_AANMAAK," & _
          "FAC_USRRAP_TEMPLATE," & _
          "FAC_USRRAP_MACRO," & _
          "FAC_USRRAP_VRAAGBEGINDATUM," & _
          "FAC_USRRAP_VRAAGEINDDATUM," & _
          "FAC_USRRAP_FUNCTIE,"&_
          "FAC_USRRAP_AUTOREFRESH,"&_
          "FAC_FUNCTIE_KEY)" & _
          " values (" & _
          ToSQL(fldFAC_USRRAP_OMSCHRIJVING, "Text") & "," & _
          ToSQL(fldFAC_USRRAP_VIEW_NAME, "Text") & "," & _
          ToSQL(fldFAC_USRRAP_INFO, "Text") & "," & _
          ToSQL(fldFAC_USRRAP_IN_HUIDIGE_LOCATIE, "Text") & "," & _
          SysDate & "," & _
          ToSQL(fldFAC_USRRAP_TEMPLATE, "Text") & "," & _
          ToSQL(fldFAC_USRRAP_MACRO, "Text") & "," & _
          ToSQL(fldFAC_USRRAP_VRAAGBEGINDATUM, "Number") & "," & _
          ToSQL(fldFAC_USRRAP_VRAAGEINDDATUM, "Number") & "," & _
          ToSQL(fldFAC_USRRAP_FUNCTIE, "Number") & "," & _
          ToSql(fldFAC_USRRAP_AUTOREFRESH,"Number") & "," & _
          ToSql(fldFAC_FUNCTIE_KEY,"Number") &_
          ")"
' UserrapRecord Insert Event end
'-------------------------------
      if sSQL = "" then
      sSQL = "insert into FAC_USRRAP (" & _
          "FAC_USRRAP_OMSCHRIJVING," & _
          "FAC_USRRAP_VIEW_NAME," & _
          "FAC_USRRAP_INFO," & _
          "FAC_USRRAP_IN_HUIDIGE_LOCATIE," & _
          "FAC_USRRAP_AANMAAK," & _
          "FAC_USRRAP_TEMPLATE," & _
          "FAC_USRRAP_MACRO," & _
          "FAC_USRRAP_VRAAGBEGINDATUM," & _
          "FAC_USRRAP_VRAAGEINDDATUM," & _
          "FAC_USRRAP_FUNCTIE," & _
          "FAC_FUNCTIE_KEY," & _
          "FAC_USRRAP_AUTOREFRESH)" & _
          " values (" & _
          ToSQL(fldFAC_USRRAP_OMSCHRIJVING, "Text") & "," & _
          ToSQL(fldFAC_USRRAP_VIEW_NAME, "Text") & "," & _
          ToSQL(fldFAC_USRRAP_INFO, "Text") & "," & _
          ToSQL(fldFAC_USRRAP_IN_HUIDIGE_LOCATIE, "Text") & "," & _
          ToSQL(fldFAC_USRRAP_AANMAAK, "Date") & "," & _
          ToSQL(fldFAC_USRRAP_TEMPLATE, "Text") & "," & _
          ToSQL(fldFAC_USRRAP_MACRO, "Text") & "," & _
          ToSQL(fldFAC_USRRAP_VRAAGBEGINDATUM, "Number") & "," & _
          ToSQL(fldFAC_USRRAP_VRAAGEINDDATUM, "Number") & "," & _
          ToSQL(fldFAC_USRRAP_FUNCTIE, "Number") & "," & _
          ToSQL(fldFAC_FUNCTIE_KEY, "Number") & "," & _
          fldFAC_USRRAP_AUTOREFRESH & _
          ")"
      end if
    case "update"
'-------------------------------
' UserrapRecord Update Event begin
sSQL = "update FAC_USRRAP set " & _
        "FAC_USRRAP_OMSCHRIJVING=" & ToSQL(fldFAC_USRRAP_OMSCHRIJVING, "Text") & _
        ",FAC_USRRAP_VIEW_NAME=" & ToSQL(fldFAC_USRRAP_VIEW_NAME, "Text") & _
        ",FAC_USRRAP_INFO=" & ToSQL(fldFAC_USRRAP_INFO, "Text") &_
        ",FAC_USRRAP_AUTOREFRESH=" & ToSQL(fldFAC_USRRAP_AUTOREFRESH,"Number") &_
        ",FAC_USRRAP_FUNCTIE=" & ToSQL(fldFAC_USRRAP_FUNCTIE,"Number") &_
        ",FAC_FUNCTIE_KEY=" & ToSQL(fldFAC_FUNCTIE_KEY,"Number")
sSQL = sSQL & " where " & sWhere
' UserrapRecord Update Event end
'-------------------------------
      if sSQL = "" then
      sSQL = "update FAC_USRRAP set " & _
        "FAC_USRRAP_OMSCHRIJVING=" & ToSQL(fldFAC_USRRAP_OMSCHRIJVING, "Text") & _
        ",FAC_USRRAP_VIEW_NAME=" & ToSQL(fldFAC_USRRAP_VIEW_NAME, "Text") & _
        ",FAC_USRRAP_INFO=" & ToSQL(fldFAC_USRRAP_INFO, "Text") & _
        ",FAC_USRRAP_IN_HUIDIGE_LOCATIE=" & ToSQL(fldFAC_USRRAP_IN_HUIDIGE_LOCATIE, "Text") & _
        ",FAC_USRRAP_AANMAAK=" & ToSQL(fldFAC_USRRAP_AANMAAK, "Date") & _
        ",FAC_USRRAP_TEMPLATE=" & ToSQL(fldFAC_USRRAP_TEMPLATE, "Text") & _
        ",FAC_USRRAP_MACRO=" & ToSQL(fldFAC_USRRAP_MACRO, "Text") & _
        ",FAC_USRRAP_VRAAGBEGINDATUM=" & ToSQL(fldFAC_USRRAP_VRAAGBEGINDATUM, "Number") & _
        ",FAC_USRRAP_VRAAGEINDDATUM=" & ToSQL(fldFAC_USRRAP_VRAAGEINDDATUM, "Number") & _
        ",FAC_USRRAP_FUNCTIE=" & ToSQL(fldFAC_USRRAP_FUNCTIE, "Number") & _
        ",FAC_FUNCTIE_KEY=" & ToSQL(fldFAC_FUNCTIE_KEY, "Number") & _
        ",FAC_USRRAP_AUTOREFRESH=" & fldFAC_USRRAP_AUTOREFRESH
      sSQL = sSQL & " where " & sWhere
      end if
    case "delete"
'-------------------------------
' UserrapRecord Delete Event begin
' UserrapRecord Delete Event end
'-------------------------------
      sSQL = "delete from FAC_USRRAP where " & sWhere
  end select
'-------------------------------
'-------------------------------
' UserrapRecord BeforeExecute Event begin
' UserrapRecord BeforeExecute Event end
'-------------------------------

'-------------------------------
' Execute SQL statement
'-------------------------------
if len(sUserrapRecordErr) > 0 then Exit Sub
  on error resume next
  if bExecSQL then 
    cn.execute sSQL
  end if
  sUserrapRecordErr = ProcessError
  on error goto 0
  if len(sUserrapRecordErr) > 0 then Exit Sub
  cn.Close
  Set cn = Nothing
  response.redirect sActionFileName & sParams
'-------------------------------
' UserrapRecord Action end
'-------------------------------
end sub
'===============================

'===============================
' Display Record Form
'-------------------------------
Sub UserrapRecord_Show()
'-------------------------------
' UserrapRecord Show begin
'-------------------------------
  Dim sWhere : sWhere = ""
  Dim sFormTitle: sFormTitle = "Details rapportage"
  Dim bPK : bPK = True
  Dim sFAC_FUNCTIE_KEYDisplayValue: sFAC_FUNCTIE_KEYDisplayValue = ""

'-------------------------------
' Load primary key and form parameters
'-------------------------------
  if sUserrapRecordErr = "" then
    SetVar "Trn_sFAC_USRRAP_OMSCHRIJVING", GetParam("sFAC_USRRAP_OMSCHRIJVING")
    SetVar "Trn_sFAC_USRRAP_VIEW_NAME", GetParam("sFAC_USRRAP_VIEW_NAME")
    pFAC_USRRAP_KEY = GetParam("FAC_USRRAP_KEY")
    SetVar "UserrapRecordError", ""
  else
    fldFAC_USRRAP_OMSCHRIJVING = GetParam("FAC_USRRAP_OMSCHRIJVING")
    fldFAC_USRRAP_VIEW_NAME = GetParam("FAC_USRRAP_VIEW_NAME")
    fldFAC_USRRAP_INFO = GetParam("FAC_USRRAP_INFO")
    fldFAC_USRRAP_IN_HUIDIGE_LOCATIE = GetParam("FAC_USRRAP_IN_HUIDIGE_LOCATIE")
    fldFAC_USRRAP_AANMAAK = GetParam("FAC_USRRAP_AANMAAK")
    fldFAC_USRRAP_TEMPLATE = GetParam("FAC_USRRAP_TEMPLATE")
    fldFAC_USRRAP_MACRO = GetParam("FAC_USRRAP_MACRO")
    fldFAC_USRRAP_VRAAGBEGINDATUM = GetParam("FAC_USRRAP_VRAAGBEGINDATUM")
    fldFAC_USRRAP_VRAAGEINDDATUM = GetParam("FAC_USRRAP_VRAAGEINDDATUM")
    fldFAC_USRRAP_FUNCTIE = GetParam("FAC_USRRAP_FUNCTIE")
    fldFAC_FUNCTIE_KEY = GetParam("FAC_FUNCTIE_KEY")
    fldFAC_USRRAP_AUTOREFRESH = getCheckBoxValue(GetParam("FAC_USRRAP_AUTOREFRESH"), "1", "0", "Number")
    SetVar "Trn_sFAC_USRRAP_OMSCHRIJVING", GetParam("Trn_sFAC_USRRAP_OMSCHRIJVING")
    SetVar "Trn_sFAC_USRRAP_VIEW_NAME", GetParam("Trn_sFAC_USRRAP_VIEW_NAME")
    pFAC_USRRAP_KEY = GetParam("PK_FAC_USRRAP_KEY")
    SetVar "sUserrapRecordErr", sUserrapRecordErr
    SetVar "FormTitle", sFormTitle
    Parse "UserrapRecordError", False
  end if
'-------------------------------

'-------------------------------
' Load all form fields

'-------------------------------

'-------------------------------
' Build WHERE statement

  if IsEmpty(pFAC_USRRAP_KEY) then bPK = False
  
  sWhere = sWhere & "FAC_USRRAP_KEY=" & ToSQL(pFAC_USRRAP_KEY, "Number")
  SetVar "PK_FAC_USRRAP_KEY", pFAC_USRRAP_KEY
'-------------------------------
'-------------------------------
' UserrapRecord Open Event begin
' UserrapRecord Open Event end
'-------------------------------

  SetVar "FormTitle", sFormTitle

'-------------------------------
' Build SQL statement and open recordset
'-------------------------------
  sSQL = "select * from FAC_USRRAP where " & sWhere
  openrs rs, sSQL
  bIsUpdateMode = (bPK and not(sAction = "insert" and sForm = "UserrapRecord") and not rs.eof)
'-------------------------------

'-------------------------------
' Load all fields into variables from recordset or input parameters
'-------------------------------
  if bIsUpdateMode then
    fldFAC_USRRAP_AANMAAK = GetValue(rs, "FAC_USRRAP_AANMAAK")
    fldFAC_USRRAP_IN_HUIDIGE_LOCATIE = GetValue(rs, "FAC_USRRAP_IN_HUIDIGE_LOCATIE")
    fldFAC_USRRAP_KEY = GetValue(rs, "FAC_USRRAP_KEY")
    fldFAC_USRRAP_MACRO = GetValue(rs, "FAC_USRRAP_MACRO")
    fldFAC_USRRAP_TEMPLATE = GetValue(rs, "FAC_USRRAP_TEMPLATE")
    fldFAC_USRRAP_VRAAGBEGINDATUM = GetValue(rs, "FAC_USRRAP_VRAAGBEGINDATUM")
    fldFAC_USRRAP_VRAAGEINDDATUM = GetValue(rs, "FAC_USRRAP_VRAAGEINDDATUM")

'-------------------------------
' Load data from recordset when form displayed first time
'-------------------------------
    if sUserrapRecordErr = "" then
      fldFAC_USRRAP_OMSCHRIJVING = GetValue(rs, "FAC_USRRAP_OMSCHRIJVING")
      fldFAC_USRRAP_VIEW_NAME = GetValue(rs, "FAC_USRRAP_VIEW_NAME")
      fldFAC_USRRAP_INFO = GetValue(rs, "FAC_USRRAP_INFO")
      fldFAC_USRRAP_FUNCTIE = GetValue(rs, "FAC_USRRAP_FUNCTIE")
      fldFAC_FUNCTIE_KEY = GetValue(rs, "FAC_FUNCTIE_KEY")
      fldFAC_USRRAP_AUTOREFRESH = GetValue(rs, "FAC_USRRAP_AUTOREFRESH")
    end if
    SetVar "UserrapRecordInsert", ""
    Parse "UserrapRecordEdit", False
'-------------------------------
' UserrapRecord ShowEdit Event begin
' UserrapRecord ShowEdit Event end
'-------------------------------
  else
    if sUserrapRecordErr = "" then
      fldFAC_USRRAP_VRAAGBEGINDATUM= "0"
      fldFAC_USRRAP_VRAAGEINDDATUM= "0"
      fldFAC_USRRAP_FUNCTIE= "0"
    end if
    SetVar "UserrapRecordEdit", ""
    Parse "UserrapRecordInsert", False
'-------------------------------
' UserrapRecord ShowInsert Event begin
' UserrapRecord ShowInsert Event end
'-------------------------------
  end if
  Parse "UserrapRecordCancel", false
'-------------------------------
' UserrapRecord Show Event begin
' UserrapRecord Show Event end
'-------------------------------

'-------------------------------
' Show form field
'-------------------------------
      SetVar "FAC_USRRAP_KEY", ToHTML(fldFAC_USRRAP_KEY)
      SetVar "FAC_USRRAP_OMSCHRIJVING", ToHTML(fldFAC_USRRAP_OMSCHRIJVING)
      SetVar "FAC_USRRAP_VIEW_NAME", ToHTML(fldFAC_USRRAP_VIEW_NAME)
      SetVar "FAC_USRRAP_INFO", ToHTML(fldFAC_USRRAP_INFO)
      SetVar "FAC_USRRAP_IN_HUIDIGE_LOCATIE", ToHTML(fldFAC_USRRAP_IN_HUIDIGE_LOCATIE)
      SetVar "FAC_USRRAP_AANMAAK", ToHTML(fldFAC_USRRAP_AANMAAK)
      SetVar "FAC_USRRAP_TEMPLATE", ToHTML(fldFAC_USRRAP_TEMPLATE)
      SetVar "FAC_USRRAP_MACRO", ToHTML(fldFAC_USRRAP_MACRO)
      SetVar "FAC_USRRAP_VRAAGBEGINDATUM", ToHTML(fldFAC_USRRAP_VRAAGBEGINDATUM)
      SetVar "FAC_USRRAP_VRAAGEINDDATUM", ToHTML(fldFAC_USRRAP_VRAAGEINDDATUM)
      SetVar "UserrapRecordLBFAC_USRRAP_FUNCTIE", ""
      LOV = Split("0;on-gestylede;1;gestylede;2;procedure;3;procedure gestyled;8;Via tabelizer", ";")
      if (ubound(LOV) mod 2) = 1 then
        for i = 0 to ubound(LOV) step 2
          SetVar "ID", LOV(i) : SetVar "Value", LOV(i+1)
          if cstr(LOV(i)) = cstr(fldFAC_USRRAP_FUNCTIE) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
          Parse "UserrapRecordLBFAC_USRRAP_FUNCTIE", True
        next
      end if
    
      SetVar "UserrapRecordLBFAC_FUNCTIE_KEY", ""
      SetVar "Selected", ""
      SetVar "ID", ""
      SetVar "Value", sFAC_FUNCTIE_KEYDisplayValue
      Parse "UserrapRecordLBFAC_FUNCTIE_KEY", True
      openrs rsFAC_FUNCTIE_KEY, "select fac_functie_key, fac_functie_omschrijving from fac_functie order by fac_functie_omschrijving asc"
      while not rsFAC_FUNCTIE_KEY.EOF
        SetVar "ID", GetValue(rsFAC_FUNCTIE_KEY, 0) : SetVar "Value", GetValue(rsFAC_FUNCTIE_KEY, 1)
        if cstr(GetValue(rsFAC_FUNCTIE_KEY, 0)) = cstr(fldFAC_FUNCTIE_KEY) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
        Parse "UserrapRecordLBFAC_FUNCTIE_KEY", True
        rsFAC_FUNCTIE_KEY.MoveNext
      wend
      set rsFAC_FUNCTIE_KEY = nothing
    
  if (LCase(fldFAC_USRRAP_AUTOREFRESH) = LCase("1")) then
    SetVar "FAC_USRRAP_AUTOREFRESH_CHECKED", "CHECKED"
  else
    SetVar "FAC_USRRAP_AUTOREFRESH_CHECKED", ""
  end if

  Parse "FormUserrapRecord", False

'-------------------------------
' UserrapRecord Close Event begin
' UserrapRecord Close Event end
'-------------------------------

Set rs = Nothing

'-------------------------------
' UserrapRecord Show end
'-------------------------------
End Sub
'===============================
%>