Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drill Down Form Design

Status
Not open for further replies.

incagold

Programmer
Mar 21, 2003
54
Good Day,

Newbie question. Is there a way to design a form that would allow the user to select a record from form displaying records selected from a database and then have that selection open a second form where further details of the record selected can be displayed? If so can you provide an example of the code? I am lost. I believe I can get the data from the database for the first form but don't know how to go about selecting and activating the second form. I am a complete novice to VB and any help would be sincerely appreciated.

Thank you
 
incagold,

DataGrid and DBGrid have convenient Button property. Set it to true.
Inside _ButtonClick event you can show another form with it's own grid that you will populate with any recordset you want to.

VladK
 
Thank you for your response VladK. Excuse my ignorance, as I said I am a total novice here and I don't seem to find the button to whivh you refer. I can get the First screen populated with data but I don't know what to do from there. What am I missing?

Thanks
 
incagold,

You just need to right click on the data grid. From the drop down menu, select "Properties...", select Layout tab. You will see the Button check box. Select a column and check it. You can do it in the code also:
DataGrid1.Columns(MyColumnIndex).Button = True
I prefer do it in the code when I setup the grid.

Make sure to enable this feature for the column(s) you need. This button is for the column. That is, all cells in the column selected would get the button. It appears like a dropdown button on the combo box and is intended for the lists. For example, to provide selections for the column entries. But you can use it for anything thanks to the buttonclick event.

Hope, this helps.

Vladk



 
incagold,

If you use flex grid, then such a button is not available.
You can utilize _DblClick event in this case:

Private Sub MSFlexGrid1_DblClick()
With MSFlexGrid1
If .Col = MyColumn Then
If .Row = MyRow Then
MySeconForm.Show
End If
End If
End With
End Sub

MySecondForm could have it's own grid that would be populated based on the info from the cell being double clicked.

Vladk
 
Vladk,

Thank you very much for the help. I am slowly learning and getting suggestions from those with the experience helps me tremendously.

Thanks again

IncaGold
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top