Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Posts
    395

    Unhappy Unanswered: Re: main form won't open. Why?

    Hi,
    I have a main form won't open up and no error displayed. It won't open in the code or thru the database window. I placed a break point in form's open form event it doesn't get executed. I can open the subform alone w/o problems. I did added some code at the end the subroutine and I also commented out but it still won't work.

    Private Sub Form_Open(Cancel As Integer)

    tableName = "tblTmp_inspec"
    'inspec_id = Me.OpenArgs
    'sampling_id = 271

    str = "SELECT COUNT([NAME]) AS CNT FROM SYSOBJECTS OBJ WHERE OBJ.[NAME]= '" & tableName & "' AND XTYPE = 'U'"
    str = str & "GROUP BY [NAME]"
    rs.Open str, ..

    With display_inspec
    .ActiveConnection = CurrentProject.Connection


    Set rsdisplay_inspec = .Execute
    End With

    'added code
    'If Not (rsdisplay_inspec.EOF) Then
    Set Me.Recordset = rsdisplay_inspec
    'Else
    'MsgBox "Error has occured. There is no information found for this RMR.", vbCritical
    'End If

    If rsdisplay_inspec.state = adStateOpen Then
    rsdisplay_inspec.close
    End If

    Set display_inspec = Nothing

    Your help is always appreciated.

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Most often, this is caused by a code error. Open your database window (hold your SHIFT key and start database. Open the coded form in DESIGN view. Open the VB Editor so as to display the form's code module. In the Debug menu select: Compile {youDatabaseName}.

    This should tell you where the problem is. But fisrt....try this:

    In your code (at the bottom) change the :

    Set display_inspec = Nothing

    TO

    Set rsdisplay_inspec = Nothing



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •