Solved

Inherited DB--Please explain coding

Posted on 2014-12-02
2
150 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…

856 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