Results 1 to 4 of 4

Thread: data grid??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    29
    Does any body know how to go about this??

    I have a MSFlexgrid that i am populating from a database.
    During run time, i want the user to go to the grid a select
    a row and hit ENTER or Command button and the information will be populated into a new form for the user to edit.
    Does anybody know if this can be done?? If so, have
    any leads, Thanks

    altecjjf


  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374

    Talking

    MSFlexGrid is a read-only display, so I don't know if this
    is possible. Why don't you use a DataGrid instead and
    block all of the editing functions? With the datagrid,
    when the user highlights a row, the recordset moves to that
    row. Then you can just use the data of the current record
    to populate the new form.

  3. #3
    Member
    Join Date
    Jul 2000
    Location
    Australia
    Posts
    37
    You duplicate the contents of the flexgrid in an array then use the row property of the flexgrid to find the correct recordset.
    The data can then be placed on the form.


    This SQL opens up the correct recordset to be edited and searched for by using the row property of the FlexGrid

    SQL = "Select distinct AgentRep.AgentID,OInspect.ODate,OInspect.HourBegin,OInspect.HourEnd,OInspect.OInspecttionID From AgentRep,OInspect Where AgentRep.AgentID = OInspect.AgentID Order By AgentRep.AgentID"
    Set rs2 = db.OpenRecordset(SQL, dbOpenSnapshot)
    ThisRow = Grid1.Row - 1

    I set the criteria to equal the index number held in the array to provide the search key

    criteria = House(ThisRow)
    rs2.Close


    Set ws = DBEngine.Workspaces(0)
    Set db = ws.OpenDatabase(App.Path & "\Reagent97.mdb")
    Data2.Recordset.Close

    'I open the recordset to display the information and seek the search key


    Set rs3 = db.OpenRecordset("OInspect", dbOpenTable)
    rs3.index = "OInspecttionID"
    rs3.Seek "=", criteria

    rs3.Close



  4. #4
    New Member
    Join Date
    Jul 2000
    Location
    Tysons Corner, VA
    Posts
    4
    I have taken the appropriate information from the cells in the MSFlexGrid then used either the rs.Find or rs.Filter methods to obtain the "matching" Bookmark (note: rs = RecordSet). This technique is straight-forward but tedious. If possible, I think you should use the DataGrid instead of the MSFlexGrid since, as mentioned earlier, the MSFlexGrid is really for display only. Good Luck!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width