Solved

Inherited DB--Please explain coding

Posted on 2014-12-02
2
141 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
Comment Utility
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
Comment Utility
Thank You
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now