String Variable Array created from Query

sphynx

Registered User.
Local time
Today, 10:52
Joined
Nov 21, 2007
Messages
82
Hi some more advice and guidance is needed :)

I am in the midst of building an access application to import and sort CSV files generated from plant equipment. I have the files correctly importing into access via VB code.

Within the code the file location is selected via an open dialog box manually by the user, I would like to automate this file selection so new files are automatically uploaded when the access application is opened.

I have code which generates a file list and inserts into a table & have setup a unique query which gives me a list of files which need to be uploaded to the database.

I am stuck with how to then use the file names from my query within my VB code to upload the correct files.

I believe that a variable array may be the answer, but am not sure whether this is the correct way to go.

Also I have no experience in building and using array variables so any advice or guidance would be greatley appreciated.

I can post code so far if required but choose not to at this point as the post would have been quite large.
 
You don't necessarily need an array, if you use recordsets in vba this will surfice

Code:
Dim Rs As DAO.Recordset
Dim StrFileName As String

Set Rs = CurrentDb.OpenRecordset("YourTableOrQueryNameHere")

Do Until Rs.EOF
    StrFileName = Rs("YourfieldNameHere")
    Run your code here....
    Rs.MoveNext
Loop
Rs.Close
Set Rs = Nothing

David
 
Thanks for the quick response I will give it a go now and let you know how I get on.

:D
 
Code worked a treat, after some fiddling and adjusting I now have the ability to import multiple files from my server location automatically on opening my application.

Well Chuffed, thanks
 

Users who are viewing this thread

Back
Top Bottom