Solved

Inherited DB--Please explain coding

Posted on 2014-12-02
2
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

689 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