how do I "FORMS"

  • Thread starter Thread starter Dib
  • Start date Start date
D

Dib

Hi,

how do I call a form to open from another form.

example

I have a frmLogIn and an frmError

The frmError have a ListBox. If the frmLogin generated an error I want the
error to show in the ListBox on frmError.

Here is the code I have

Private Sub ErrorLog()

Dim errLoop As ADODB.Error

' Change mousepointer to normal.

System.Windows.Forms.Cursor.Current =
System.Windows.Forms.Cursors.WaitCursor



Select Case errcase

Case 1, 2, 3

If errcase = 1 Then

If Cn.Errors.Count = 0 Then

Exit Sub

End If

End If

If errcase = 2 Then

Response = MsgBox(MsgConnUn, vbOKOnly, Title)

End If

If errcase = 3 Then

If Cn.Errors.Count = 0 Then

Exit Sub

End If

End If

For Each errLoop In Cn.Errors

Dim strError(5)

Dim i As Integer

strError(0) = "Error Number: " & errLoop.Number

strError(1) = " Description: " & errLoop.Description

strError(2) = " Source: " & errLoop.Source

strError(3) = " SQL State: " & errLoop.SQLState

strError(4) = " Native Error: " & errLoop.NativeError

i = 0

Do While i < 5

frmError.lstErrors.Items.add(strError(i)) 'Error is here lstErrors is the
ListBox

i = i + 1

Loop

frmError.lstErrors.Items.add("") 'Error is here lstErrors is the ListBox



Next ' Continue looping through ADO Errors collection.

' Create string for summary count of errors.

c = Cn.Errors.Count & " provider error(s) occurred."

' Display a count of the provider errors.

frmError.lstErrors.Items.add(c) 'Error is here lstErrors is the ListBox

'frmError.lstErrors.Items.add("") 'Error is here lstErrors is the ListBox

frmError.Show() 'Error is here

' Clear the ADO errors collection.

Cn.Errors.Clear()

Case Else ' Fall-through case statement.

Exit Sub

End Select

End Sub



Thanks

Dib
 
Dib said:
how do I call a form to open from another form.

Declare the form variable name before you use it, like you would
any other variable name....
Private Sub ErrorLog()

Dim errLoop As ADODB.Error
Dim frmError As New frmError


See if that helps....
LFS
 
Back
Top