TheDutch IceMan
01-14-2004, 03:45 PM
I tried everything, searched the web, this forum but nothing helps.... :confused:
I am trying to refresh a MSHFLEXGRID which is on another form.
When my frmFind is shown (vbModal) it shows records in a MSHFLEXGRID. After clicking one of those, I can hit a button called "Update" and another form is opening with corresponding fields to update the record by means of a stored procedure.
After updating I try to refresh the MSHFLEXGRID but untill now I didn't have any success.
Here's the code:
Opening frmFind and getting the records:
Public Sub setFlexgrid(fg As MSHFlexGrid)
'ged rid of any source
Set fg.DataSource = Nothing
'clear the grid
fg.Clear
fg.Height = Picture1.Height
fg.Top = Picture1.Top
ThinBorder fg.hwnd, True
'format the grid
Call FormatGridBefore(fg)
'the recordset
Set gobjRs = New ADODB.Recordset
'check for empty string (for stored procedure)
If strSP <> "" Then
Call FillRecordSet(strSP, gobjRs, True)
'check if the connection is open
If gobjRs.State = adStateOpen Then
'set datasource
Set fg.DataSource = gobjRs
're-format (for fixed row)
Call FormatGridAfter(fg)
'no records, set the buttons conform
If gobjRs.RecordCount = 0 Then
Me.Command1(0).Enabled = False
Me.Command1(4).Enabled = False
Me.Command1(5).Enabled = False
Me.lstSorteren.Enabled = False
Me.txtZoeken.Enabled = False
End If
'close and clear mem.
gobjRs.Close
Set gobjRs = Nothing
Else
Call FormatGridAfter(fg)
Exit Sub
End If
End If
End Sub
Within frmEditAfdeling
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call frmFind.setFlexgrid(frmFind.MSHFlexGrid1)
End Sub
Anybody has an idea of what i am doing wrong?
I've tried the "Thinker" method but without succes
Private Sub ClearFG()
Set MSHFG1.DataSource = Nothing
MSHFG1.Clear
MSHFG1.Rows = 2
MSHFG1.Cols = 1
End Sub
So I must do something wrong........ :confused: :(
I am trying to refresh a MSHFLEXGRID which is on another form.
When my frmFind is shown (vbModal) it shows records in a MSHFLEXGRID. After clicking one of those, I can hit a button called "Update" and another form is opening with corresponding fields to update the record by means of a stored procedure.
After updating I try to refresh the MSHFLEXGRID but untill now I didn't have any success.
Here's the code:
Opening frmFind and getting the records:
Public Sub setFlexgrid(fg As MSHFlexGrid)
'ged rid of any source
Set fg.DataSource = Nothing
'clear the grid
fg.Clear
fg.Height = Picture1.Height
fg.Top = Picture1.Top
ThinBorder fg.hwnd, True
'format the grid
Call FormatGridBefore(fg)
'the recordset
Set gobjRs = New ADODB.Recordset
'check for empty string (for stored procedure)
If strSP <> "" Then
Call FillRecordSet(strSP, gobjRs, True)
'check if the connection is open
If gobjRs.State = adStateOpen Then
'set datasource
Set fg.DataSource = gobjRs
're-format (for fixed row)
Call FormatGridAfter(fg)
'no records, set the buttons conform
If gobjRs.RecordCount = 0 Then
Me.Command1(0).Enabled = False
Me.Command1(4).Enabled = False
Me.Command1(5).Enabled = False
Me.lstSorteren.Enabled = False
Me.txtZoeken.Enabled = False
End If
'close and clear mem.
gobjRs.Close
Set gobjRs = Nothing
Else
Call FormatGridAfter(fg)
Exit Sub
End If
End If
End Sub
Within frmEditAfdeling
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call frmFind.setFlexgrid(frmFind.MSHFlexGrid1)
End Sub
Anybody has an idea of what i am doing wrong?
I've tried the "Thinker" method but without succes
Private Sub ClearFG()
Set MSHFG1.DataSource = Nothing
MSHFG1.Clear
MSHFG1.Rows = 2
MSHFG1.Cols = 1
End Sub
So I must do something wrong........ :confused: :(