borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Controlling ShortCutMenuBars)Next Topic (How to make two databases link) New Topic New Poll Post Reply
AndreaVB Forum : Database : FlexGrid? how to retrieve a the current recordset
Poster Message
w32crazydev
Level: Guest


icon FlexGrid? how to retrieve a the current recordset

hey could anyone please tell me how can i retrieve the current recordset from a flexgrid control..what i mean is :when a user selects an entire row in the grid control this row has data contained in a specific recordset?HOW CAN I access those data fields and the entire recordset by using an "grdDataGrid." like command please help me...         

22-07-2002 at 03:37 PM
| Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 891
icon Re: FlexGrid? how to retrieve a the current recordset

Hi,
Add a hidden column and put the primary key into it, then when the user clicks a row, use this hidden column to find the row in the RS. ie
public function FindRSWhereCol0IsPK(gd as msFlexGrid, rsSource as recordset)as recordset
  dim rsClone as recordset
  set rsClone = rsSource.Clone
  rsClone.Find "[pkfield]='" & gd.textmatrix(gd.row, 0) & "'"
  if rsclone.eof then goto exith
  set FindRSWhereCol0IsPK = rsclone
exith:
end function
Hope this helps
Kieron
PS. FlexGrid is not data-bound, as far as I am aware, hence the runaround.


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

29-09-2002 at 11:57 PM
View Profile Send Email to User Show All Posts | Quote Reply
noycez
Level: VB Guru


Registered: 14-10-2002
Posts: 79
icon Re: FlexGrid? how to retrieve a the current recordset

...you can also use a loop comparing the "Bookmark" of your current record in the recordset and the cuurent row that the user had clicked, then use "Do..While". Put this on your flexgrid's click event:

--------------------------------------------
If flxGrid.Row > mRec.Bookmark Then
    Do While flxGrid.Row <> mRec.Bookmark
        mRec.MoveNext
    Loop
Else
    Do While flxGrid.Row <> mRec.Bookmark
        mRec.MovePrevious
    Loop
End If

--------------------------------------------
...then get the current field's data


____________________________
Funny thought:

Practice makes perfect.....
But nobody's perfect......
so why practice?

14-10-2002 at 07:24 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : FlexGrid? how to retrieve a the current recordset
Previous Topic (Controlling ShortCutMenuBars)Next Topic (How to make two databases link) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder