Click to See Complete Forum and Search --> : data grid??
Altecjjf
Aug 8th, 2000, 01:09 PM
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
DrewDog_21
Aug 8th, 2000, 03:45 PM
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.
whittam
Aug 9th, 2000, 05:20 AM
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
GeraldB13
Aug 10th, 2000, 10:07 AM
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!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.