Solved

Inherited DB--Please explain coding

Posted on 2014-12-02
2
146 Views
Last Modified: 2014-12-02
Private Sub SaveRecord3(ByVal strField As String)
    Dim lngRecapIdx As Long, l As Long, bolFoundIt As Boolean, lngLastRecord As Long, lngTableIndex As Long, strCName As String
    Dim ctl As Variant
   
    bolFoundIt = False
    lngRecapIdx = Me.RecapIdx
    lngTableIndex = Me.Controls(strField).TabIndex
   
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Me.Requery
   
    Me.Recordset.FindFirst "RecapIdx=" & lngRecapIdx
    Me.Controls(strField).SetFocus
    SendKeys "{TAB}"
0
Comment
Question by:Jass Saini
2 Comments
 
LVL 28

Accepted Solution

by:
omgang earned 500 total points
ID: 40477419
It looks to me like the procedure is simply saving the current form record, refreshing the form, and then moving to the next control on the form.
OM Gang


Private Sub SaveRecord3(ByVal strField As String)
<< procedure that requires a string value to be passed into it as a parameter/argument.  Based upon the following code it appears the string value should be the name of a control on the form >>

     Dim lngRecapIdx As Long, l As Long, bolFoundIt As Boolean, lngLastRecord As Long, lngTableIndex As Long, strCName As String
     Dim ctl As Variant
<< variable declarations >> 
     
     bolFoundIt = False
<< initialize Boolean variable to False >>

     lngRecapIdx = Me.RecapIdx
<< assign the value of form control named 'RecapIdx' to the variable lngRecapIdx >>

     lngTableIndex = Me.Controls(strField).TabIndex
<< assign the value of the TabIndex property of the form control specified by the value of strField to the variable lngTableIndex >>
     
     DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
<< perform a menu action - in this case it's supposed to save the current record >>

     Me.Requery
<< requery/refresh the form recordset >>
     
     Me.Recordset.FindFirst "RecapIdx=" & lngRecapIdx
<< find in the forms underlying recordset the record that has RecapIdx = the value of the variable lngRecapIdx; make sure we're working with the same record as we were prior to the requery >>

     Me.Controls(strField).SetFocus
<< set focus on the form control specified by the value of the variable strField -- this is the same control name that was passed in to the procedure as an argument >>

     SendKeys "{TAB}"
<< press the TAB key -- cause the focus to move to the next form control as specified by the tab order >>
0
 

Author Closing Comment

by:Jass Saini
ID: 40477538
Thank You
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question