Add an editable column to a bound query

Posted on 2014-09-02
Last Modified: 2014-09-02
I am pulling up the following query to my datagrid in a vb6 form.  The resulting query results cannot be edited,  However, I would like to add a temporary column at the end of the results which will enable me to add temporary data.  Is this possible?

select g.Agency,g.Goal,o.Objective,p.PI,P.Method,a.[ActivityName],P.[ProjectedHours],a.Data, s.ProgressSetback
from tblOrgGoals G 
LEFT Join tblOrgObjectives O on G.GoalID = O.GoalID and g.agencyid=o.agencyid
LEFT Join tblOrgActivities A on O.ObjectiveID = A.ObjectiveID and g.agencyid=a.agencyid
LEFT Join tblOrgPI P on P.ActivityID = A.ActivityID and g.agencyid=p.agencyid
LEFT Join tblOrgMonthlyProgressSetbacks S on p.PIID = s.piid and g.agencyid=s.agencyid
Where s.AgencyID = 74 And s.monthlyid = 3 And s.piid = 1  order by G.Agency,G.Goal

Open in new window

Question by:al4629740

    Author Comment

    This question asks how to add an additional column at the end of a table in a datagrid.  Different question, but delete if you deem it to be so.
    LVL 34

    Accepted Solution

    There are several ways to do this including adding a column to your ADO Datatable or just adding an empty column to your SELECT.

    select g.Agency,g.Goal,o.Objective,p.PI,P.Method,a.[ActivityName],P.[ProjectedHours],a.Data, s.ProgressSetback, '' AS TempColumn --Casting would be a good idea here to get the type and size you need

    Open in new window


    Author Comment

    Thank you.  That's exactly what I was looking for.  Is there a way to edit the column directly with the mouse?  Either Datagrid or msflexgrid?
    LVL 34

    Expert Comment

    by:Brian Crowe
    Unfortunately that's more of a VB question and I haven't done any VB programming in years.

    I would suggest posting another question or googling it.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
    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…
    Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

    745 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

    14 Experts available now in Live!

    Get 1:1 Help Now