Solved

HFlexGrid Bug

Posted on 2003-10-28
5
177 Views
Last Modified: 2010-05-03
When I add a record to a recordset and associate to an empty HFlexgrid control in vb6 it does'nt display properly. I am using a Win 2000 platform with Access 2000 as back-end with ADO recordset
Is there any way to correct it.
0
Comment
Question by:rprasanna14
  • 2
5 Comments
 
LVL 18

Expert Comment

by:Sethi
ID: 9647156
Post the code.
0
 

Author Comment

by:rprasanna14
ID: 9647796
Here's the code ...
set Hflexgrid.datasource=nothing    
rsShipment.Open "SHAPE {SELECT ShipmentId,Sample.SampleName, ShipmentDetail.Quantity, BranchName, ShipmentDetail.ExpectedDate, ShipmentDetail.Status " & _
            " FROM Sample, ShipmentDetail, CompanyBranch WHERE Sample.SampleId = ShipmentDetail.ItemId AND CompanyBranch.BranchId = ShipmentDetail.Destination AND POID=" & POID & " Order By ShipmentID,ItemId} AS Command2 " & _
            "COMPUTE Command2 BY 'ShipmentID','BranchName','ExpectedDate'", conn, adOpenStatic, adLockReadOnly
set Hflexgrid.datasource=rsshipment

This is empty initially.
Now at runtime I add records and again requery it. Although data gets saved properly, display is'nt correct.
Also, when I stop and re-run the application display gets correct.
0
 
LVL 18

Accepted Solution

by:
Sethi earned 125 total points
ID: 9648106
This is because when you add records you have refill flexgrdi again. i.e. you will have call this procedure again. When you set the datasource property of the flexgird, it binds the datasource in static manner and it would not notice any changes to the database dynamically. Close the recordset just after this line:
set Hflexgrid.datasource=rsshipment
rsshipment.close

to avoid any error on recalling the sub.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

943 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

6 Experts available now in Live!

Get 1:1 Help Now