Using MS Access/Run Function After Loop

Advertisement


Question
Facts:

1.  The Program reads a table and export each column name to a database.

2.  I want to run this function after the loop below.

sNewPwd = Get_System_Setting_Pwd("DEFAULT_OUTPUT_DATABASE_PWD")

Program:

Set db = CurrentDb()
       Set RS = db.OpenRecordset("tmp01ARESTableNames")         
       Count = 0
       ReDim Preserve AnArray(0)         
       RS.MoveFirst     
       Do Until RS.EOF
         
DoCmd.TransferDatabase acExport, "Microsoft Access", sExtDb, _
       acTable, RS.Fields("Table_Name"), RS.Fields      ("Table_Name"), True     

       RS.MoveNext        
       Loop

I want to run the function below after the loop finishes.
I can't get it to start or run after the loop finishes.

Function:

sNewPwd = Get_System_Setting_Pwd("DEFAULT_OUTPUT_DATABASE_PWD")


        
       RS.Close         
       accessApp.Quit
       Set accessApp = Nothing

Answer
How do you know it doesn't run? All that line of code does is assign the value returned by the function to the variable sNewPwd. You are not doing anything with that variable.

Hope this helps,
Scott<>
Blog: http://scottgem.wordpress.com
Website: http://www.diamondassoc.com
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Education/Credentials
Brooklyn College BA

©2016 About.com. All rights reserved.