Solved

Question on MSHFlexgrid in VB

Posted on 2002-04-05
12
290 Views
Last Modified: 2012-08-14
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
        oMSHFlexKey.Clear
       
        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
        Else
          '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
rstShwRNo.Close

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

End Sub
0
Comment
Question by:pnc
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 20

Expert Comment

by:hes
ID: 6921760
Where is your rstShwRNo.Open

(3704 This error occurs when the recordset has not been opened yet.)
0
 

Author Comment

by:pnc
ID: 6921762
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.

pnc
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6921765
i think you have some problems with ado.
did you load correct mdac on user's machine?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 5

Expert Comment

by:rkot2000
ID: 6921772
to hes
it's in GetRcdSet(sSQL, cnnCAD, rstShwRNo)


0
 
LVL 1

Accepted Solution

by:
soferstam earned 200 total points
ID: 6922111
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.
0
 

Author Comment

by:pnc
ID: 6929399
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

ErrHandler:
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.

pnc
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6929412
can you create a udl file on user's pc and test your connection to the database?
0
 
LVL 1

Expert Comment

by:soferstam
ID: 6929422
You connection as closed.
Can you chech your connection state inside this prosidure?
0
 

Author Comment

by:pnc
ID: 6934161
Hi All,

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

PNC
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6934283
you can't Uninstall mdac.
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6934297
0
 

Author Comment

by:pnc
ID: 6937911
Thanks Soferstam,

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

pnc
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now