VilaRestal
';drop database master;--
- Local time
- Today, 07:31
- Joined
- Jun 8, 2011
- Messages
- 1,046
There is a common structure in access database I build where there is continuous form (for example I'll call it frmList) showing a list of records with a button on each record to open the record's detail in anoterh form designed for that purpose (for example I'll call that frmDetail).
Changes made on frmDetail might affect the data shown for that record on frmList. It is essential (and should be straightforward but I'm finding it isn't) to 'refresh' the data behind frmList so it is uptodate.
Obviously, a simple Me.Requery statement will move back to the first record, which is intollerable.
The only way I've found to do this is from the cmdOpenDetail button's click event something like this:
Note: This is an an adp (frmList uses a not complex sql server view as its recordsource)
This works fine until about the 4,500th record (on a 5,000 record datasource - I haven't checked the figure [by trial and error: the only way to discover it ] for other recordset sizes) after which it simply doesn't find the record. I.e. doesn't move to it but the record is there and shows in the form if you scroll to it.
I tried using a recordsetclone (where it does Find the record) and getting the AbsolutePosition of the record in that and then using GoToRecord or rsMe.Move to that position but neither of those worked either (were less reliable and the code gets very clunky)
I've also tried to use the Resync method but can't make head nor tail of that: I could get it do nothing, or give errors or seem to hang the screen with redraws but never what it needs to do.
So, my questions are these:
If anyone could answer either of those (the first especially) I'd be immensely grateful.
Thanks in advance but I'm not optimistic
Changes made on frmDetail might affect the data shown for that record on frmList. It is essential (and should be straightforward but I'm finding it isn't) to 'refresh' the data behind frmList so it is uptodate.
Obviously, a simple Me.Requery statement will move back to the first record, which is intollerable.
The only way I've found to do this is from the cmdOpenDetail button's click event something like this:
Code:
Private Sub cmdOpenDetail_Click()
Dim iR As Long
iR = Me!recordID
DoCmd.OpenForm "frmDetail", , , "recordID = " & iR, , acDialog
'Sub resumes after form is closed (it was opened as a dialog):
Me.Requery
Dim rsMe As Recordset
Set rsMe = Me.Recordset
rsMe.Find "recordID = " & iR
Set rsMe = Nothing
End Sub
Note: This is an an adp (frmList uses a not complex sql server view as its recordsource)
This works fine until about the 4,500th record (on a 5,000 record datasource - I haven't checked the figure [by trial and error: the only way to discover it ] for other recordset sizes) after which it simply doesn't find the record. I.e. doesn't move to it but the record is there and shows in the form if you scroll to it.
I tried using a recordsetclone (where it does Find the record) and getting the AbsolutePosition of the record in that and then using GoToRecord or rsMe.Move to that position but neither of those worked either (were less reliable and the code gets very clunky)
I've also tried to use the Resync method but can't make head nor tail of that: I could get it do nothing, or give errors or seem to hang the screen with redraws but never what it needs to do.
So, my questions are these:
- Is there a better (easy, reliable) way of achieving the above (requery the record that was current in frmList before the frmDetail version of it was opened to reflect any changes made in frmDetail and keep it current in frmList)?
- Is anyone else aware of that seemingly arbitrary number limitation to the Find method on a form's recordset and, if so, is there a way round it? A setting somewhere perhaps? (Not the forms max records btw, that's set to 100,000!)
If anyone could answer either of those (the first especially) I'd be immensely grateful.
Thanks in advance but I'm not optimistic