M
matteo.trombetti
I had posted a smaller problem just before, but I think it will be nice
to post my main problem as well
There is a master table, myTable, which two queries are based on, myIDs
(which simply returns primary key values for all records in the table)
and myQuery (which returns the whole table with minor modifications).
I have a subform which has its own independent RecordSource set to
myQuery and is not linked to its parent form. This subform returns
filtered records based on controls in the parent form.
The Parent form has its own RecordSource set to myIDs query.
The idea is that when the user selects a record in the subform, this
triggers the OnCurrent procedure, which will look up in the parent
form's .Recordsetclone to find the primary key selected in the subform
and set parent form's bookmark. This will allow to synchronize another
subform in the main form which is linked (master/child fields) to the
parent form.
At the beginning, the subform opens with an already set filter.
All this worked fine until the day when I came across the case where
the first record in the table was (correctly) filtered out: this caused
Access to crash - and that is systematical.
All other cases (set/unset filters, switch from one record to another
and so on) work perfectly when the first record is not filtered out
(but for example others are).
Also, I found out that upon commenting the code line that updates the
bookmark in parent form, Access does not crash - and of course nothing
is synchronized anymore - This is the cursed procedure:
Private Sub mySubForm_OnCurrent
Dim rst As DAO.Recordset
Set rst = Me.Parent.RecordsetClone
With rst
.FindFirst "[myID]=" & Me!myID
' Me.Parent.Bookmark = rst.Bookmark '****************comment
End With
End Sub
Do you have any idea to solve or go around the problem??
Thanks a lot to everybody,
Matteo
to post my main problem as well
There is a master table, myTable, which two queries are based on, myIDs
(which simply returns primary key values for all records in the table)
and myQuery (which returns the whole table with minor modifications).
I have a subform which has its own independent RecordSource set to
myQuery and is not linked to its parent form. This subform returns
filtered records based on controls in the parent form.
The Parent form has its own RecordSource set to myIDs query.
The idea is that when the user selects a record in the subform, this
triggers the OnCurrent procedure, which will look up in the parent
form's .Recordsetclone to find the primary key selected in the subform
and set parent form's bookmark. This will allow to synchronize another
subform in the main form which is linked (master/child fields) to the
parent form.
At the beginning, the subform opens with an already set filter.
All this worked fine until the day when I came across the case where
the first record in the table was (correctly) filtered out: this caused
Access to crash - and that is systematical.
All other cases (set/unset filters, switch from one record to another
and so on) work perfectly when the first record is not filtered out
(but for example others are).
Also, I found out that upon commenting the code line that updates the
bookmark in parent form, Access does not crash - and of course nothing
is synchronized anymore - This is the cursed procedure:
Private Sub mySubForm_OnCurrent
Dim rst As DAO.Recordset
Set rst = Me.Parent.RecordsetClone
With rst
.FindFirst "[myID]=" & Me!myID
' Me.Parent.Bookmark = rst.Bookmark '****************comment
End With
End Sub
Do you have any idea to solve or go around the problem??
Thanks a lot to everybody,
Matteo