473,406 Members | 2,849 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,406 software developers and data experts.

Some help explaining a snippet of code?

114 100+
Could anyone help explain the following snippet of code? I'm not quite sure how it works. Thanks!

Expand|Select|Wrap|Line Numbers
  1. Public Counter As Integer
  2. Private Sub Form_Load()
  3. If Me.CurrentRecord > 0 Then
  4.         DoCmd.GoToRecord acActiveDataObject, "", acLast
  5.         Counter = Me.CurrentRecord
  6.         DoCmd.GoToRecord acActiveDataObject, "", acFirst
  7. Else
  8.         MsgBox "There are no new issues.", vbOKOnly, "First Issues"
  9.         DoCmd.Close acForm, "frmEditReport", acSaveNo
  10.         Exit Sub
  11. End If
  12. End Sub
Software: Access 2003
Form: frmEditReport
Form's Record Source: qryEditReport
Mar 26 '08 #1
1 1348
ADezii
8,834 Expert 8TB
Could anyone help explain the following snippet of code? I'm not quite sure how it works. Thanks!

Expand|Select|Wrap|Line Numbers
  1. Public Counter As Integer
  2. Private Sub Form_Load()
  3. If Me.CurrentRecord > 0 Then
  4.         DoCmd.GoToRecord acActiveDataObject, "", acLast
  5.         Counter = Me.CurrentRecord
  6.         DoCmd.GoToRecord acActiveDataObject, "", acFirst
  7. Else
  8.         MsgBox "There are no new issues.", vbOKOnly, "First Issues"
  9.         DoCmd.Close acForm, "frmEditReport", acSaveNo
  10.         Exit Sub
  11. End If
  12. End Sub
Software: Access 2003
Form: frmEditReport
Form's Record Source: qryEditReport
It appears as though this code will:
  1. Calculate the Total Number of Records in the Record Source of the displayed Form (by navigating to the Last Record) and placing its value in the Public Variable Counter (Lines 4 and 5). This will only be done if there is a Current Record.
  2. Reposition the Record Pointer to the first Record (Line 6).
  3. If there is no Current Record, display a Message Box and close frmEditReport (Lines 8 and 9).
Mar 26 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Az Tech | last post by:
Hi people, (Sorry for the somewhat long post). I request some of the people on this group who have good experience using object-orientation in the field, to please give some good ideas for...
193
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I...
2
by: rahul8143 | last post by:
hello, I am confused with following programs snippet code about how the answer comes? statement/expression is evaluated? 1) int i=5; i=i++*i++*i++*i++; why the answer is not 5*6*7*8= 1680 but...
4
by: rodchar | last post by:
Code Snippet 1 public class CustomerInfoCollection : IList { private ArrayList m_alCustomerInfo; private DataSet m_ds; public CustomerInfoCollection() {
19
by: felixnielsen | last post by:
Some might remember that i, not so long ago, started a treath or two about a weird 3d labyrinth. I now have a working code, that i want to share, hear comments, advice, ect., but first let me...
2
by: daokfella | last post by:
Hi all, I've created a code snippet in VS 2005 and saved it in the proper snippet folder. When I right-click and select Insert Snippet, I navigation to My Code Snippets and it shows my snippet....
3
by: Hardy | last post by:
I created a code snippet which is for displaying file name,Line number and function name in C#.NET project. // <File> sf.GetFileName() // </File> // <Line> sf.GetFileLineNumber().ToString()...
2
by: steve.falzon | last post by:
Hi I've been searching high and low for this info but have been unsuccessful so far. I wonder if anybody knows where I can get a specification for the directives contained within the code...
4
by: tshad | last post by:
I was watching a video that used a code snippet to create a property and when you type "prop" tab tab, it would create the private variable as well as the property definitions with the private...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.