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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Some advice on opening different forms from MSHFlexgrid

Status
Not open for further replies.

hpicken

Technical User
Apr 12, 2001
142
AU
Yeah I know another new user question (sigh).

I creating a vb6 frontend to an acc2k mdb. This mdb has 2 tables like so

Table1: full list of names with id, record type
Table2: full details for all records (about 40 fields) unique on id

The reason for having 2 tables is that the db is quite large and doing a soundex search on just the table with a few fields ended up being much much quicker. The data is completely read only no records to add, edit or delete.

I have 4 forms what I want to do is open a record from the flexgrid in the form for that record type.

In my case the record type can be B (birth), D (death), M (Marriage) etc.

All of the data is in Table2 so it only has to open one recordset but a different form (different data gets shown) is required.

I'm using a MSHFlexGrid for searching and sorting and this all working great (finally).

So I guess I need to select a given record from the grid read what type of record it is, open the appropiate form and fill it with data based on the id.

Phew... can someone please give me some pointers. This was all very easy in Access with an open form with openargs.

cheers
Howard
 
YES!!! Worked it out myself.

pat on the back for me :)

cheers
Howard
 
Ok... ok [grin]

Code:
Private Sub MSHFlexGrid1_DblClick()
Dim tmpType As String

tmpType = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 4)

    If Len(tmpType) > 1 Then
        tmpType = Right(tmpType, 1)
    End If

    useBookmark = True
    If tmpType = "M" Then
        frmMarriageDetails.ID.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 1)
        frmMarriageDetails.Show
        Exit Sub
    ElseIf tmpType = "B" Then
        frmBaptismDetails.ID.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 1)
        frmBaptismDetails.Show
        Exit Sub
    ElseIf tmpType = "D" Then
        frmBurialDetails.ID.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 1)
        frmBurialDetails.Show
        Exit Sub
    End If
    
End Sub

cheers
Howard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top