投稿時間:2006/10/03(Tue) 00:18 投稿者名:こう
Eメール:
URL :
タイトル:Re^2: 画面呼び出しで実行時エラー「438」が発生
「Hide」の使い方、使う位置は、間違ってないでしょうか。
最小限のコードです。 訂正版です。 ---------------------------------------- Form1
Private Sub Command1_Click() Dim Result As Integer
Result = Form2.PANEL_INIT If Result <> 0 Then Unload Form2 Exit Sub End If Form2.Show Form2.Data_Delivery "1", "2", "3" 'Unload Me Hide End Sub
Private Sub Command2_Click() Form3.Show 1, Form1 End Sub
Private Sub Form_Load() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" End Sub
------------------------------------- Form2
Friend Function PANEL_INIT() As Integer On Error Resume Next
Set objSess = CreateObject("OracleInProcServer.XOraSession") Set objDb = objSess.OpenDatabase("dbname", "user/password", 0&)
strSQL = "SELECT ・・・・" Set objDs = objDb.DbCreateDynaset(strSQL, 12&) Set objCol = objDs.Fields
If objDb.lastservererr <> 0 Then MsgBox "ORACLEでエラーが発生しました。" & Chr(13) & Chr(10) & _ "(Oracle Error:" & objDb.lastservererr & " Text:" & objDb.LastServerErrText & ")" GoTo EXIT_ERR End If
処理1 処理2 処理3
PANEL_INIT = 0
Exit Function
'エラー処理 EXIT_ERR: PANEL_INIT = 1 'エラートラップ終了 On Error GoTo 0
End Function
Private Sub Command1_Click() Form1.Show Unload Me End Sub
Public Sub Data_Delivery(ByVal varid1 As String, ByVal varid2 As String, ByVal varid3 As String) Text1.Text = varid1 Text2.Text = varid2 Text3.Text = varid3 End Sub
-------------------------------- Form3
Option Explicit Private Sub Command1_Click() Unload Me End Sub
Private Sub Form_Load() Dim objSess As Object Dim objDb As Object Dim objDs As Object Dim objCol As Object Dim strSQL As String Dim ErrMsg As String
Set objSess = CreateObject("OracleInProcServer.XOraSession") Set objDb = objSess.OpenDatabase("dbname", "user/password", 0&)
strSQL = "SELECT ・・・・" Set objDs = objDb.DbCreateDynaset(strSQL, 12&) Set objCol = objDs.Fields
If objDb.lastservererr <> 0 Then MsgBox "ORACLEでエラーが発生しました。" & Chr(13) & Chr(10) & _ "(Oracle Error:" & objDb.lastservererr & " Text:" & objDb.LastServerErrText & ")" Exit Sub ElseIf Err <> 0 Then Err.Eaise Err ErrMsg = Err.Description MsgBox ErrMsg, vbOKOnly + vbCritical, "VBエラーメッセージ" Exit Sub End If If Not objDs.EOF Then Exit Sub End If If Not IsNull(objDs(0).Value) Then Text1.Text = objDs(0).Value End If If Not IsNull(objDs(1).Value) Then Text2.Text = objDs(1).Value End If If Not IsNull(objDs(2).Value) Then Text2.Text = objDs(2).Value End If End Sub
|