hexagon logo

Basic Forms automatisation

Hello

I need help with VB form for user input on begining of measurement
We have 32 PCDMIS CMM. We want to a little automated process for measurement and I made one user form for inputting data when we start measuring program.
Form we will use for inputting some data for Q-das database. (In attachment is picture of form).

My problem is keep the data in from after run or after click OK. Form works fine and give us all necessity info and data into tracefileds, but when we run program from beginning we always get totally empty form. That is very hard that operator need to fill everything in form from beginning even if change only for example, sample Id

Can someone please help me with code which will do that, I mean keep the last entered data in form even we leave program or restart pcdmis..

Thank you very much.

Attached Files
Parents
  • I have only this code in form on: EventInitialize

    Dim Plant As String
    Dim CMM As String
    Dim Inspector As String
    Dim MeasType As String
    Dim SampSta As String
    Dim MachProd As String


    'Plant data K0057


    If Len(dir("C:\CNC\Plant.dat"))<2 Then
    MsgBox "File not found"
    cbxPlantK0057.AddString "A"
    cbxPlantK0057.AddString "B"
    cbxPlantK0057.AddString "C"
    Else
    Open "C:\CNC\Plant.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, Plant
    cbxPlantK0057.AddString Plant
    Loop
    Close #1
    End If

    'CMM data K0012

    If Len(dir("C:\CNC\CMM.dat"))<2 Then
    MsgBox "File not found"
    cbxCMMK0012.AddString "A"
    cbxCMMK0012.AddString "B"
    cbxCMMK0012.AddString "C"
    Else
    Open "C:\CNC\CMM.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, CMM
    cbxCMMK0012.AddString CMM
    Loop
    Close #1
    End If

    'Inspector data K0008

    If Len(dir("C:\CNC\Inspector.dat"))<2 Then
    MsgBox "File not found"
    cbxInspectorK0008.AddString "A"
    cbxInspectorK0008.AddString "B"
    cbxInspectorK0008.AddString "C"
    Else
    Open "C:\CNC\Inspector.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, Inspector
    cbxInspectorK0008.AddString Inspector
    Loop
    Close #1
    End If

    'Measure Type data K0055

    If Len(dir("C:\CNC\MeasureType.dat"))<2 Then
    MsgBox "File not found"
    cbxMeasTypK0055.AddString "A"
    cbxMeasTypK0055.AddString "B"
    cbxMeasTypK0055.AddString "C"
    Else
    Open "C:\CNC\MeasureType.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, MeasType
    cbxMeasTypK0055.AddString MeasType
    Loop
    Close #1
    End If


    'Sample Status data K0056

    If Len(dir("C:\CNC\SampleStatus.dat"))<2 Then
    MsgBox "File not found"
    cbxSampStaK0056.AddString "A"
    cbxSampStaK0056.AddString "B"
    cbxSampStaK0056.AddString "C"
    Else
    Open "C:\CNC\SampleStatus.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, SampSta
    cbxSampStaK0056.AddString SampSta
    Loop
    Close #1
    End If

    'cbxMachprodK0010

    If Len(dir("C:\CNC\Machine.dat"))<2 Then
    MsgBox "File not found"
    cbxMachprodK0010.AddString "A"
    cbxMachprodK0010.AddString "B"
    cbxMachprodK0010.AddString "C"
    Else
    Open "C:\CNC\Machine.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, MachProd
    cbxMachprodK0010.AddString MachProd
    Loop
    Close #1
    End If


Reply
  • I have only this code in form on: EventInitialize

    Dim Plant As String
    Dim CMM As String
    Dim Inspector As String
    Dim MeasType As String
    Dim SampSta As String
    Dim MachProd As String


    'Plant data K0057


    If Len(dir("C:\CNC\Plant.dat"))<2 Then
    MsgBox "File not found"
    cbxPlantK0057.AddString "A"
    cbxPlantK0057.AddString "B"
    cbxPlantK0057.AddString "C"
    Else
    Open "C:\CNC\Plant.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, Plant
    cbxPlantK0057.AddString Plant
    Loop
    Close #1
    End If

    'CMM data K0012

    If Len(dir("C:\CNC\CMM.dat"))<2 Then
    MsgBox "File not found"
    cbxCMMK0012.AddString "A"
    cbxCMMK0012.AddString "B"
    cbxCMMK0012.AddString "C"
    Else
    Open "C:\CNC\CMM.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, CMM
    cbxCMMK0012.AddString CMM
    Loop
    Close #1
    End If

    'Inspector data K0008

    If Len(dir("C:\CNC\Inspector.dat"))<2 Then
    MsgBox "File not found"
    cbxInspectorK0008.AddString "A"
    cbxInspectorK0008.AddString "B"
    cbxInspectorK0008.AddString "C"
    Else
    Open "C:\CNC\Inspector.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, Inspector
    cbxInspectorK0008.AddString Inspector
    Loop
    Close #1
    End If

    'Measure Type data K0055

    If Len(dir("C:\CNC\MeasureType.dat"))<2 Then
    MsgBox "File not found"
    cbxMeasTypK0055.AddString "A"
    cbxMeasTypK0055.AddString "B"
    cbxMeasTypK0055.AddString "C"
    Else
    Open "C:\CNC\MeasureType.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, MeasType
    cbxMeasTypK0055.AddString MeasType
    Loop
    Close #1
    End If


    'Sample Status data K0056

    If Len(dir("C:\CNC\SampleStatus.dat"))<2 Then
    MsgBox "File not found"
    cbxSampStaK0056.AddString "A"
    cbxSampStaK0056.AddString "B"
    cbxSampStaK0056.AddString "C"
    Else
    Open "C:\CNC\SampleStatus.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, SampSta
    cbxSampStaK0056.AddString SampSta
    Loop
    Close #1
    End If

    'cbxMachprodK0010

    If Len(dir("C:\CNC\Machine.dat"))<2 Then
    MsgBox "File not found"
    cbxMachprodK0010.AddString "A"
    cbxMachprodK0010.AddString "B"
    cbxMachprodK0010.AddString "C"
    Else
    Open "C:\CNC\Machine.dat" For Input As #1
    Do While Not EOF(1)
    Line Input #1, MachProd
    cbxMachprodK0010.AddString MachProd
    Loop
    Close #1
    End If


Children
No Data