Below is a small sample of the code that loads the first
form. Once I double click on the edit part I want it to
call another form (that I have already created) and load
the event data of the same scenario that was on this first
form.
Pam
Public Function LoadScenarioFor Edit(ScenarioNa me As
String) As Boolean
Dim filenum As Integer, strData As String, dlim As
String * 1, i As Integer
LoadScenarioFor Edit = True
Me.Tag = ScenarioName
Me.Caption = ScenarioName & " - Scenario Editor"
ScenarioInfoFil e = ROOT_DIR & WORK_DIR & ScenarioName
& "." & ScenarioInfo_EX T
ScenarioEventFi le = ROOT_DIR & WORK_DIR & ScenarioName
& "." & ScenarioEvent_E XT
'Load scenario information file
filenum = FreeFile
On Error Resume Next
Open ScenarioInfoFil e For Input As #filenum
Line Input #filenum, strData
Close #filenum
If InStr(strData, vbTab) = 0 Then 'Tab delimiter
not found
If InStr(strData, ";") <> 0 Then
dlim = ";"
End If
If InStr(strData, ",") <> 0 Then
dlim = ","
End If
If dlim = " " Then 'Unable to determine data
delimiter
MsgBox "No valid data delimiter for file "
& filename, vbCritical
Else 'Convert delimiter to tab
Do
i = InStr(strData, dlim)
strData = Left(strData, i - 1) & vbTab &
Right(strData, Len(strData) - i)
Loop While InStr(strData, dlim) > 0
End If
End If
With dgdScenarioInfo
.AddItem strData
txtName.Text = .TextMatrix(0, 0)
txtVersion.Text = .TextMatrix(0, 1)
txtModDate.Text = .TextMatrix(0, 2)
txtHours.Text = .TextMatrix(0, 5)
txtRate.Text = .TextMatrix(0, 3)
lblRunTimeValue .Caption = .TextMatrix(0, 4)
lblSEvalue.Capt ion = .TextMatrix(0, 6)
lblEIvalue.Capt ion = .TextMatrix(0, 7)
lblREvalue.Capt ion = .TextMatrix(0, 8)
txtComment.Text = .TextMatrix(0, 9)
End With
End If
'Load scenario event file
dlim = " "
filenum = FreeFile
On Error Resume Next
Open ScenarioEventFi le For Input As #filenum
If Err.Number <> 0 Then
strData = "Error opening file " &
ScenarioEventFi le & " Error: " & Err.Number & " " &
Err.Description
WriteLog strData
MsgBox strData, vbCritical, "Edit scenario " &
ScenarioName
LoadScenarioFor Edit = False
Exit Function
Else
Line Input #filenum, strData
If InStr(strData, vbTab) = 0 Then 'Tab delimiter
not found
If InStr(strData, ";") <> 0 Then dlim = ";"
If InStr(strData, ",") <> 0 Then dlim = ","
If dlim = " " Then 'Unable to determine data
delimiter
MsgBox "Unable to determine file delimiter
for file " & filename, vbCritical
Else 'Convert delimiter to tab
Do
i = InStr(strData, dlim)
strData = Left(strData, i - 1) & vbTab &
Right(strData, Len(strData) - i)
Loop While InStr(strData, dlim) > 0
End If
-----Original Message-----
Hi Pam,
You're not telling us much. :-(
What data? What file?
Can you show us what you're doing and tell us what
does/doesn't happen?
Regards,
Fergus
.