Question on MSHFlexgrid in VB

Hi All,

I am using MSHFlexgrid in my form.And i am showing data in the MSHFlexgrid.Its working find in my computer.I packaged my application, and i installed in my user m/c.When i test in user m/c its saying unexpected error 3704 ( operation is not allowed when the object is clossed.) I checked the MSHFlexgrid ActiveX control existed in user m/c.I tried back and forth in different ways to fix this problem. I didn't get the solution.

could you tell me what may be the problem.

Note: I am using the following procedure to load data into MSHFlexGrid control

Public Sub SetShowkeyRNo(oMSHFlexKey As MSHFlexGrid, sBill_Code As String, sSysDate As String, iRNo As Integer)
Rem This procedure is used for Depending on the Record number that was selected from the user.

Dim sSQL As String
Dim rstShwRNo As New ADODB.Recordset
Dim lcsrPrev As Long

On Error GoTo Err_SetShowKeyRNo

sSQL = ""
sSQL = "SELECT Distinct(Rec_No),Ind_Sys_Date,Fund_cont_val,Net_unbill,WIP_date,Cont_date_bill_amt,Last_inv_date," _
        & "Draft_inv_Amt,Cont_Type,Enga_start_date,Enga_end_date,Audit_comm" _
        & " FROM KeySumm WHERE Bill_Code = '" & sBill_Code & "' AND (Ind_Sys_Date <= #" & sSysDate & "#) AND (Rec_No <= " & iRNo & ") ORDER BY Rec_No DESC"
        If GetRcdSet(sSQL, cnnCAD, rstShwRNo) Then

    If rstShwRNo.State <> adStateClosed Then
        'Turn off redrawing to avoid flickering
        oMSHFlexKey.Redraw = False
        If rstShwRNo.RecordCount > 0 Then
          Set oMSHFlexKey.Recordset = rstShwRNo
          oMSHFlexKey.ColWidth(0) = "600"
          oMSHFlexKey.ColWidth(1) = "1000"
          oMSHFlexKey.ColWidth(11) = "4000"
          oMSHFlexKey.RowHeight(oMSHFlexKey.Row) = 250
          'oMSHFlexKey.AllowUserResizing = True
          oMSHFlexKey.Redraw = True
          oMSHFlexKey.FocusRect = flexFocusLight
          'oMSHFlexKey.Redraw = True
          'oMSHFlexKey.ColWidth(5) = "3000"
          'oMSHFlexKey.RowHeight(1) = "500"
          oMSHFlexKey.Text = "No histary records found!"
        End If
    End If
End If
Rem close the record set

Rem Exit from the procedure
Exit Sub
      Select Case Err
    Case 0
      ReplaceCursor lcsrPrev
      Exit Sub
    Case Else
      AssertError modName & ".SetShowKeyRNo"
  End Select
  Resume Err_SetShowKeyRNo

End Sub
Who is Participating?
soferstamConnect With a Mentor Commented:
Well,looks to mee the error inside GetRcdSet()
Please put break there and check a)is connection open properly? a)Can you open a recordset?
Regarding the second question,-do you mean how to clean-up the grid?-Use clear method.But then you have to rebuild the flex dinamically.
Where is your rstShwRNo.Open

(3704 This error occurs when the recordset has not been opened yet.)
pncAuthor Commented:
And also when i ever i run the application, some times in the MSHFlexGrid control area is pasting with previous window.How i can get only Flexgrid data.

The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

i think you have some problems with ado.
did you load correct mdac on user's machine?
to hes
it's in GetRcdSet(sSQL, cnnCAD, rstShwRNo)

pncAuthor Commented:
Hi All,

I observed i am getting error inside GetRcdSet().
Function GetRcdSet(aSQL As String, cnnDB As ADODB.Connection, rstRecordSet As ADODB.Recordset) As Boolean
On Error GoTo ErrHandler
    GetRcdSet = True
    rstRecordSet.Open aSQL, cnnDB, adOpenKeyset
    Exit Function

GetRcdSet = False

End Function
Its working in my development computer.But not in user m/c.Which one i installed data Access components.Like mdac_typ 2.5.1 or mdac_typ 2.5.2

But i already installed mdac_typ 2.5 service pack 2.But still i am getting same error.Do you know which one i install again.

can you create a udl file on user's pc and test your connection to the database?
You connection as closed.
Can you chech your connection state inside this prosidure?
pncAuthor Commented:
Hi All,

Do you know how i can Uninstall MDAC_TYP package in user computer.

you can't Uninstall mdac.
pncAuthor Commented:
Thanks Soferstam,

Your answer is right in my case. Once again thanks for your help.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.