Hi Al and Jeanette,
Thanks for your replies.
Al you are indeed correct (I got my subforms mixed up), and performing
requery on the initial subform, then on subform #2 fixed the problem.
However, this has created a new annoyance, when you select a record on sub
form #2, and then click the check box on the initial subform and perform
the
two requeries, the record selector on sub form number 2, go back to the
beggining of the recordset. There are between anywhere 300 - 600 items in
this list so its a pain to re-scroll back down to where you were.
So now what I would like to do is take a snap shot of the record set
before
the requery, and then move back to after - I have tried using this code
but I
get overflow errors:
Private Sub Valid_Click()
Me.Requery
Me.Parent.[ServerList].SetFocus
Dim rs, rs1 As DAO.Recordset
Dim bkMark As Long
' Search in the clone set, and get the current RecID.
Set rs = Me.RecordsetClone
rs.FindFirst "[RecID] = '" & Me.RecID & "'"
bkMark = Me.RecID
Me.Requery
If Not rs.NoMatch Then
' Set the record selector back to where it was before the requery
Set rs1 = Me.RecordsetClone
rs1.FindFirst "[RecID] = " & bkMark
Me.Bookmark = rs1.Bookmark 'reposition the form
End If
Set rs = Nothing
End Sub
Can anyone advise how to acheive this?
Cheers,
GLT.
Al Campagna said:
GLT,
I think there's some confusion on your post as to which sub
is updating what sub in your scenario, but...
When changing a value on Sub1 that would effect a value on Sub2,
try Refreshing Sub1 first, and then Requerying Sub2.
The Refresh of Sub1 forces the values in the current record to be
written to it's table. (This would be the equivalent of moving off the
current record, and back). If the Sub2 re-value is based upon that
newly
updated table,
then a Requery of Sub2 should do the trick.
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love... and you'll never work a day in your
life."
GLT said:
Hi Jeanette,
Thanks for your reply,
I used your code and I beleive it works (I can see the subform flicker
and
the record selector goes to the 1st record in the subform), however I
am
still faced with the original problem, ie. the subform values do not
update
until I select another record on that subform. I do not understand why
this
is happeneing, I have tried the following, however it seems the only
way
to
get around this is to setfocus to the subform, move +1 records, then -1
records...
Me.Parent.[ServerList].SetFocus
Me.Parent.[ServerList].Form.Requery
Me.MoveNext
Me.MovePrevious
:
Assuming that both subforms are on the same form
Me.Parent.[NameOfSubformControl].Form.Requery
Note that the SubformControl may have a different name from the
subform
inside it.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Hi Barry,
Thanks for your reply, I have tried this so far:
Me.Parent![serverlist].Requery
Forms.[Get all Details].ServerList.Requery
DoCmd.Requery Forms.Parent.serverlist
None of them work...
:
this is in the ballpark
in the checkbox's after update event
docmd.requery "subform#2"
the correct reference to the subform will be important for example
it
may
need to be Me!subform#2 or forms!mainform.subform#2 and im not the
best
at
that.
Barry
:
Hi,
I have a main form with two subforms, one linked and one not.
When I select a checkbox on Subform#1, it affects a value on
Subform#2
(and
changes it green).
However, this only updates on Subform#1, after I select a new
record
on
that
subform.
So, my question is, how can I force subform#1 to refresh after I
have
clicked my check box on Subform#2?
Any help is always greatly appreciated.
Cheers,
GLT.
.
.