Solved

Inherited DB--Please explain coding

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

730 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