473,402 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

refresh not working

This program is only for use as a demonstration when working with
recordsets. The idea is that the record set s processed to determine how
many books out by junior, adult and senior members of a library. The
Form_Open event presents the correct totals.

Private Sub Form_Open(Cancel As Integer)
Dim totj As Integer, tota As Integer, tots As Integer
Call OpenRecSet
Do
If Rec("Memb_Cat") = 1 Then
totj = totj + Val(Rec("Memb_BooksOut"))
ElseIf Rec("Memb_Cat") = 2 Then
Tota = Tota + Val(Rec("Memb_BooksOut"))
Else
tots = tots + Val(Rec("Memb_BooksOut"))
End If
Rec.MoveNext
Loop Until Rec.EOF

Me.Txt_JBooks = totj
Me.Txt_ABooks = tota
Me.Txt_SBooks = tots

Rec.Close

However when a new rec is entered and the Memb_BooksOut_AfterUpdate() event
triggered when the BooksOut field is updated, the totals on the form are not
immediately refreshed. Why?

Private Sub Memb_BooksOut_AfterUpdate()

.. same code as above, but ending in .

Me.Refresh

End Sub

Any help given will be genuinely appreciated
Jan 27 '06 #1
2 2291
On Fri, 27 Jan 2006 08:32:22 -0000, "Geoff" <gf****@freenetname.co.uk> wrote:
This program is only for use as a demonstration when working with
recordsets. The idea is that the record set s processed to determine how
many books out by junior, adult and senior members of a library. The
Form_Open event presents the correct totals.

Private Sub Form_Open(Cancel As Integer)
Dim totj As Integer, tota As Integer, tots As Integer
Call OpenRecSet
Do
If Rec("Memb_Cat") = 1 Then
totj = totj + Val(Rec("Memb_BooksOut"))
ElseIf Rec("Memb_Cat") = 2 Then
Tota = Tota + Val(Rec("Memb_BooksOut"))
Else
tots = tots + Val(Rec("Memb_BooksOut"))
End If
Rec.MoveNext
Loop Until Rec.EOF

Me.Txt_JBooks = totj
Me.Txt_ABooks = tota
Me.Txt_SBooks = tots

Rec.Close

However when a new rec is entered and the Memb_BooksOut_AfterUpdate() event
triggered when the BooksOut field is updated, the totals on the form are not
immediately refreshed. Why?

Private Sub Memb_BooksOut_AfterUpdate()

.. same code as above, but ending in .

Me.Refresh

End Sub

Any help given will be genuinely appreciated


Me.Refresh will get changes to the records contained in the current recordset but will not get records added after the
recordset was created. MeRequery will recreate the recordset and grab any new records.
Wayne Gillespie
Gosford NSW Australia
Jan 27 '06 #2
Geoff, we cannot see what is in OpenRecSet, but presumably it opens a
Recordset type variable named Rec (which is presumably declared somewhere
else), and this recordset is reading the values from the table.

If so, the AfterUpdate even of BooksOut is too early. The change has not
been saved to the table yet. Try the AfterUpdate event of the Form instead.

Since you are demonstrating recordsets, you might like to OpenRecordset()
based on a query string such as this:
strSql = "SELECT Memb_Cat, Count([ID]) AS CountOfID FROM Memb_BooksOut
GROUP BY Memb_Cat;"
Set Rec = dbEngine(0)(0).OpenRecordset(strSql)

If you were not practicing recordsets, you would probably just put something
like this into the Control Source of the text box:
=DCount("*", "Memb_BooksOut", "Memb_Cat = 1")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Geoff" <gf****@freenetname.co.uk> wrote in message
news:I5********************@brightview.com...
This program is only for use as a demonstration when working with
recordsets. The idea is that the record set s processed to determine how
many books out by junior, adult and senior members of a library. The
Form_Open event presents the correct totals.

Private Sub Form_Open(Cancel As Integer)
Dim totj As Integer, tota As Integer, tots As Integer
Call OpenRecSet
Do
If Rec("Memb_Cat") = 1 Then
totj = totj + Val(Rec("Memb_BooksOut"))
ElseIf Rec("Memb_Cat") = 2 Then
Tota = Tota + Val(Rec("Memb_BooksOut"))
Else
tots = tots + Val(Rec("Memb_BooksOut"))
End If
Rec.MoveNext
Loop Until Rec.EOF

Me.Txt_JBooks = totj
Me.Txt_ABooks = tota
Me.Txt_SBooks = tots

Rec.Close

However when a new rec is entered and the Memb_BooksOut_AfterUpdate()
event
triggered when the BooksOut field is updated, the totals on the form are
not immediately refreshed. Why?

Private Sub Memb_BooksOut_AfterUpdate()

.. same code as above, but ending in .

Me.Refresh

End Sub

Any help given will be genuinely appreciated

Jan 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mark | last post by:
I have a working PHP/MySQL application used for data entry. The data entry screen includes a "Save" button. The PHP code for this button looks like this: if (isset($_POST)) { if ($_POST ==...
5
by: Steve | last post by:
Hi, I have a private website for 20 people that is similar to a web email client like hotmail. There are two frames, one on the left with links for "New", "History", "Todays" and a frame on the...
9
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't...
0
by: Brad White | last post by:
Overview: I have a custom web app that has an 'Inbox' that refreshes every 30 seconds. One user uses Outlook to host the web page. Using IE, the refresh works fine. If the user is working in...
0
by: CSerpent | last post by:
AFTER A "REFRESH", HOW DO I RETURN THE USER TO THE RECORD HE WAS PREVIOUSLY WORKING WITH? I have a DataTable, and a bound DataGrid. The DataTable contains a column which is Unique, but the...
12
by: martin1 | last post by:
All, is there window form refresh property? I try to set up window form refresh per minute. Thanks
3
by: David Cartwright | last post by:
Hi all, I'm having a weird time with a call to the Refresh() method of a DataGridView. I have a VB.NET 2005 Windows application with a main form and a "worker" thread. The main form delegates a...
1
jackb
by: jackb | last post by:
Hello there. I have a webpage that need to reload every 10 seconds, so I have put a meta tag: <meta http-equiv="refresh" content="10"> Now this seems to work ok. Now the problem is that my...
5
by: tshad | last post by:
I have an interface I am using to get access to some of the objects on my form: a textbox (Status) and my statusbar (StatusBar). In my class, which is actually in another class from my form I have...
4
by: Peter | last post by:
ASP.NET 3.5 I have a web page and this web page has a DataList, when user hovers the mouse over a picture in the datalist a popup appers, this popup is a User Control and it has a cancel button....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.