Hello !!
Try this !
Dim rec As New ADODB.Recordset
Private Sub Form_Initialize()
Dim SQL As String
' nur Rezepte anzeigen, die nicht als versteckt markiert sind (Hide =
false)
'SQL = "SELECT RNr, RBez, RClass, KdCode FROM tabRezepte WHERE
(Hide=false) ORDER BY RNr DESC"
' alle Rezepte werden ausgewaehlt, (Hide = false)-Auswahl wird erst bei
Filter getroffen
SQL = "SELECT RNr, RBez, RClass, KdCode, Hide FROM tabRezepte ORDER BY
RNr DESC"
With rec
Set .ActiveConnection = conDBVSG
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.Source = SQL
End With
end sub
.....
public sub .....
Dim BookMark
frmRezeptDaten.Show vbModal, Me ' Formular fr RezeptDaten ?ffnen
BookMark = rec.BookMark
rec.Requery
rec.BookMark = BookMark
RezeptListe_Refresh ' Rezeptliste, Datagrid
aktualisieren
end sub
Private Sub RezeptListe_Refresh()
With DataGrid1 ' DataGrid
' .Refresh ' not OK
Set .DataSource = rec ' It's OK
End With
' Spaltenberschriften und -Breiten von Hidden-Label bernehmen
AutoSizeGridByLabel DataGrid1, lblDataGrid, , False
txtAnzRec.Text = rec.RecordCount
End Sub
Best Regards
Harald
Quote:> Hi,
> For refreshing my data in the datagrid, I use the requery-property.
> When I do this, I set the absoluteposition of the ado recordset back to
the
> absoluteposition it was before the requery.
> When the datagrid is scrollable. The grid doesn't comes back to the state
it
> has before the requery.
> I think I must use the firstrow-property. (Thisone indicates or sets the
> first visible row)
> But when I want to set the firstrow-property, it goes wrong.
> How do I use this property?
> Greetz,
> Dennis