Solved

Question on MSHFlexgrid in VB

Posted on 2002-04-05
12
286 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

705 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

19 Experts available now in Live!

Get 1:1 Help Now