Solved

How can I make a FlexGrid editable???

Posted on 2000-04-06
7
178 Views
Last Modified: 2010-05-02
Hi,

I'm using the following code to create and populate a felxgrid with information from an Access DB. Can anyone please tell me how to edit the code in order to make the Grid editable. i.e I want to be able to update the info in the Db Table from my form.

Any help or suggestions would be greatly appreciated.
cheers,
ian


Set rs1 = New adodb.Recordset        'create recordset
    rs1.Open "select * from AdministratorPasswords", conn, adOpenKeyset,     adLockOptimistic                             'populate rs with query result


mfgFlex1.Clear 'set grid layout at run-time
    k = rs1.RecordCount
    j = rs1.Fields.Count
    mfgFlex1.Rows = k + 1
    mfgFlex1.Cols = j + 1
   
    With mfgFlex1
        lngRow = 1
        Do Until rs1.EOF
            mfgFlex1.TextMatrix(0, 1) = "Username"
            mfgFlex1.TextMatrix(0, 2) = "Password"
            For lngCol = 0 To rs1.Fields.Count - 1
                .TextMatrix(lngRow, lngCol + 1) = rs1(lngCol)
            Next lngCol
            rs1.MoveNext
            lngRow = lngRow + 1
        Loop
    End With
0
Comment
Question by:shovels
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2690506
you will need to create an invisible textbox that moves to the desired cell location and becomes visible when you want to edit the grid
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2690510
rather than post all the code just see this article:
http://msdn.microsoft.com/library/techart/msdn_msflexgrid.htm

cheers!
0
 
LVL 6

Expert Comment

by:Marine
ID: 2690716
as another person mantioned, flexgrid is read-only by default therefore you cannot edit it. You can get around it by placing the textbox into each cell when you click in it. And depending on the cell you click you would place a textbox in there.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 4

Expert Comment

by:Nazdor
ID: 2692487
Try using a DataGrid instead.

Add an ADO datasource, assign the DataGrid to it, load the datasource's recordset accordingly (which auto loads into the datagrid).  You can lock columns you don't want people to edit etc.

However, I've found it a bit clunky... :-(  So you're probably better off dealing with the extra code and sticking with your flexgrid...
0
 
LVL 5

Expert Comment

by:Voodooman
ID: 2692708
Hi!

The various grids are quite poor in VB from a user edit perspective.

Upgrade to TrueDBGrid is a good start!

I usually Pop up Record Edit forms by clicking an Edit button - allowing edit of the Selected record and close control of what the user is doing.

With the datagrids selecting a record moves the record so its easy to edit the underlying record.

Editing in the grid is clunky and difficult for the user (my opinion only!) nad difficult to control.

Good Luck

Voodoman!


0
 
LVL 1

Accepted Solution

by:
mr_krishna earned 50 total points
ID: 2693468
Put a TextBox control in the form and write the following code. There is no other way to make flexigrid is editable.

With flexgrid1
      If .Col = 2 And .Row <> .Rows - 1 Then
         bCellEdit = True
         txtCell.Top = .Top + .CellTop - 50
         txtCell.Left = .Left + .CellLeft - 50
         txtCell.Height = .CellHeight
         txtCell.Width = .CellWidth + 30
         iLastRow = .Row
         txtCell = .Text
         txtCell.Visible = True
         txtCell.SetFocus
      End If
   End With
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2693528
mr krishna that is what my link tells him, in detail the procedure to use that method
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Add a task in Outlook from access 11 43
Getting warning: You are about to delete 1 row(s) 9 61
Protecting vb6 & .Net code Obfuscation 18 210
Excel Automation VBA 19 115
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

734 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