Quantcast
Channel: Kyocera
Viewing all articles
Browse latest Browse all 69

Dynamic form and data lookup

$
0
0

Hi,

 

I am trying to my fields values when my first field is changed.

But when I change the value of the first field "NumFournisseur", nothing happens to the fields "NomFournisseur","NumContrat","email".

 

Any ideas on what's going wrong ?

Option Strict Off

Imports System
Imports System.Web
Imports System.Windows
Imports System.IO
Imports System.Data
Imports Microsoft.VisualBasic
Imports System.Data.OleDb
Imports Kyocera20Capture.Workflow
LoadAssembly:System.Data.dll

Module Script
    Sub Form_OnLoad(ByVal eventData As MFPEventData)

    End Sub
    Sub Form_OnSubmit(ByVal eventData As MFPEventData)
        
    End Sub
    
    Sub FieldName_OnChange(ByVal eventData As MFPEventData)
        
        Const adOpenStatic = 3
            Const adLockOptimistic = 3
            Const adCmdText = &H0001
            Dim NumFournisseur
            Dim objConnection
            Dim objRecordSet
            Dim strPathtoTextFile
            Dim strFile
            Dim request
        
            objConnection = CreateObject("ADODB.Connection")
            objRecordSet = CreateObject("ADODB.Recordset")

            strPathtoTextFile = "C:\Autostore\"

            objConnection.Open ("Provider=Microsoft.Jet.OLEDB.4.0;" & _
                "Data Source=" & strPathtoTextFile & ";" & _
                "Extended Properties=""text;HDR=YES;FMT=Delimited(|)""")

            strFile = "fournisseurs.csv"
        
            NumFournisseur=eventdata.Form.Fields.GetField("NumFournisseur").Value    
            
                        
        
            request = "Select F3,F2,F4 FROM" & strFile &" Where F1 =" & NumFournisseur & ""

            objRecordset.Open (request, _
                objConnection, adOpenStatic, adLockOptimistic, adCmdText)
    
        
            eventdata.Form.Fields.GetField("NomFournisseur").Value=objRecordset.Fields("F3").Value

            eventdata.Form.Fields.GetField("NumContrat").Value=objRecordset.Fields("F2").Value

            eventdata.Form.Fields.GetField("email").Value=objRecordset.Fields("F4").Value
        
    
        
    End Sub    
End Module

Viewing all articles
Browse latest Browse all 69

Trending Articles