Select Multiple Files With Browse Window

May 25, 2007

Thanks to a previous post, I was able to adapt the below code to call up a browse window in my project. However, the browse window only allows one file to be called up at a time. I would like to find a way to select multiple files in the browse window and call them all up at once. Please help

'***************** Code Start **************
'This code was originally written by Ken Getz.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
' Code courtesy of:
' Microsoft Access 95 How-To
' Ken Getz and Paul Litwin
' Waite Group Press, 1996

Type tagOPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
strFilter As String
strCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
strFile As String
nMaxFile As Long
strFileTitle As String
nMaxFileTitle As Long
strInitialDir As String
strTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
strDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean

Declare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _
Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As Boolean
Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long

Global Const ahtOFN_READONLY = &H1
Global Const ahtOFN_OVERWRITEPROMPT = &H2
Global Const ahtOFN_HIDEREADONLY = &H4
Global Const ahtOFN_NOCHANGEDIR = &H8
Global Const ahtOFN_SHOWHELP = &H10
' You won't use these.
'Global Const ahtOFN_ENABLEHOOK = &H20
'Global Const ahtOFN_ENABLETEMPLATE = &H40
'Global Const ahtOFN_ENABLETEMPLATEHANDLE = &H80
Global Const ahtOFN_NOVALIDATE = &H100
Global Const ahtOFN_ALLOWMULTISELECT = &H200
Global Const ahtOFN_EXTENSIONDIFFERENT = &H400
Global Const ahtOFN_PATHMUSTEXIST = &H800
Global Const ahtOFN_FILEMUSTEXIST = &H1000
Global Const ahtOFN_CREATEPROMPT = &H2000
Global Const ahtOFN_SHAREAWARE = &H4000
Global Const ahtOFN_NOREADONLYRETURN = &H8000
Global Const ahtOFN_NOTESTFILECREATE = &H10000
Global Const ahtOFN_NONETWORKBUTTON = &H20000
Global Const ahtOFN_NOLONGNAMES = &H40000
' New for Windows 95
Global Const ahtOFN_EXPLORER = &H80000
Global Const ahtOFN_NODEREFERENCELINKS = &H100000
Global Const ahtOFN_LONGNAMES = &H200000

Function GetFile()
Dim strFilter As String
Dim lngFlags As Long
strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda, *.mdb)", _
"*.MDA;*.MDB")
strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.DBF")
strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
' MsgBox "You selected: " & ahtCommonFileOpenSave(InitialDir:="C:", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Hello! Open Me!")

GetFile = ahtCommonFileOpenSave(InitialDir:="C:", _
Filter:=strFilter, FilterIndex:=4, Flags:=lngFlags, _
DialogTitle:="Find File")
' Since you passed in a variable for lngFlags,
' the function places the output flags value in the variable.
'Debug.Print Hex(lngFlags)
End Function

Function GetOpenFile(Optional varDirectory As Variant, _
Optional varTitleForDialog As Variant) As Variant
' Here's an example that gets an Access database name.
Dim strFilter As String
Dim lngFlags As Long
Dim varFileName As Variant
' Specify that the chosen file must already exist,
' don't change directories when you're done
' Also, don't bother displaying
' the read-only box. It'll only confuse people.
lngFlags = ahtOFN_FILEMUSTEXIST Or _
ahtOFN_HIDEREADONLY Or ahtOFN_NOCHANGEDIR
If IsMissing(varDirectory) Then
varDirectory = ""
End If
If IsMissing(varTitleForDialog) Then
varTitleForDialog = ""
End If

' Define the filter string and allocate space in the "c"
' string Duplicate this line with changes as necessary for
' more file templates.
strFilter = ahtAddFilterItem(strFilter, _
"Access (*.mdb)", "*.MDB;*.MDA")
' Now actually call to get the file name.
varFileName = ahtCommonFileOpenSave( _
OpenFile:=True, _
InitialDir:=varDirectory, _
Filter:=strFilter, _
Flags:=lngFlags, _
DialogTitle:=varTitleForDialog)
If Not IsNull(varFileName) Then
varFileName = TrimNull(varFileName)
End If
GetOpenFile = varFileName
End Function

Function ahtCommonFileOpenSave( _
Optional ByRef Flags As Variant, _
Optional ByVal InitialDir As Variant, _
Optional ByVal Filter As Variant, _
Optional ByVal FilterIndex As Variant, _
Optional ByVal DefaultExt As Variant, _
Optional ByVal FileName As Variant, _
Optional ByVal DialogTitle As Variant, _
Optional ByVal hwnd As Variant, _
Optional ByVal OpenFile As Variant) As Variant
' This is the entry point you'll use to call the common
' file open/save dialog. The parameters are listed
' below, and all are optional.
'
' In:
' Flags: one or more of the ahtOFN_* constants, OR'd together.
' InitialDir: the directory in which to first look
' Filter: a set of file filters, set up by calling
' AddFilterItem. See examples.
' FilterIndex: 1-based integer indicating which filter
' set to use, by default (1 if unspecified)
' DefaultExt: Extension to use if the user doesn't enter one.
' Only useful on file saves.
' FileName: Default value for the file name text box.
' DialogTitle: Title for the dialog.
' hWnd: parent window handle
' OpenFile: Boolean(True=Open File/False=Save As)
' Out:
' Return Value: Either Null or the selected filename
Dim OFN As tagOPENFILENAME
Dim strFileName As String
Dim strFileTitle As String
Dim fResult As Boolean
' Give the dialog a caption title.
If IsMissing(InitialDir) Then InitialDir = CurDir
If IsMissing(Filter) Then Filter = ""
If IsMissing(FilterIndex) Then FilterIndex = 1
If IsMissing(Flags) Then Flags = 0&
If IsMissing(DefaultExt) Then DefaultExt = ""
If IsMissing(FileName) Then FileName = ""
If IsMissing(DialogTitle) Then DialogTitle = ""
If IsMissing(hwnd) Then hwnd = Application.hWndAccessApp
If IsMissing(OpenFile) Then OpenFile = True
' Allocate string space for the returned strings.
strFileName = Left(FileName & String(256, 0), 256)
strFileTitle = String(256, 0)
' Set up the data structure before you call the function
With OFN
.lStructSize = Len(OFN)
.hwndOwner = hwnd
.strFilter = Filter
.nFilterIndex = FilterIndex
.strFile = strFileName
.nMaxFile = Len(strFileName)
.strFileTitle = strFileTitle
.nMaxFileTitle = Len(strFileTitle)
.strTitle = DialogTitle
.Flags = Flags
.strDefExt = DefaultExt
.strInitialDir = InitialDir
' Didn't think most people would want to deal with
' these options.
.hInstance = 0
'.strCustomFilter = ""
'.nMaxCustFilter = 0
.lpfnHook = 0
'New for NT 4.0
.strCustomFilter = String(255, 0)
.nMaxCustFilter = 255
End With
' This will pass the desired data structure to the
' Windows API, which will in turn it uses to display
' the Open/Save As Dialog.
If OpenFile Then
fResult = aht_apiGetOpenFileName(OFN)
Else
fResult = aht_apiGetSaveFileName(OFN)
End If

' The function call filled in the strFileTitle member
' of the structure. You'll have to write special code
' to retrieve that if you're interested.
If fResult Then
' You might care to check the Flags member of the
' structure to get information about the chosen file.
' In this example, if you bothered to pass in a
' value for Flags, we'll fill it in with the outgoing
' Flags value.
If Not IsMissing(Flags) Then Flags = OFN.Flags
marty = strFile
ahtCommonFileOpenSave = TrimNull(OFN.strFile)
Else
ahtCommonFileOpenSave = vbNullString
End If
End Function

Function ahtAddFilterItem(strFilter As String, _
strDescription As String, Optional varItem As Variant) As String
' Tack a new chunk onto the file filter.
' That is, take the old value, stick onto it the description,
' (like "Databases"), a null character, the skeleton
' (like "*.mdb;*.mda") and a final null character.

If IsMissing(varItem) Then varItem = "*.*"
ahtAddFilterItem = strFilter & _
strDescription & vbNullChar & _
varItem & vbNullChar
End Function

Private Function TrimNull(ByVal strItem As String) As String
Dim intPos As Integer
intPos = InStr(strItem, vbNullChar)
If intPos > 0 Then
TrimNull = Left(strItem, intPos - 1)
Else
TrimNull = strItem
End If
End Function

View Replies


ADVERTISEMENT

Modify Browse Window

Mar 15, 2007

hi all

i'm hoping some guru can help me out here, i've got a function that opens up a browse window and lets me choose what sort of file type i want to view in a directory. what i need is to modify it so i can have the option of arranging the files by the date modified, so i can have the last file saved come up as the first file available.

anyone know if this is possible???

Code:Function ahtCommonFileOpenSave( _ Optional ByRef Flags As Variant, _ Optional ByVal InitialDir As Variant, _ Optional ByVal Filter As Variant, _ Optional ByVal FilterIndex As Variant, _ Optional ByVal DefaultExt As Variant, _ Optional ByVal fileName As Variant, _ Optional ByVal DialogTitle As Variant, _ Optional ByVal hwnd As Variant, _ Optional ByVal OpenFile As Variant) As Variant' This is the entry point you'll use to call the common' file open/save dialog. The parameters are listed' below, and all are optional.'' In:' Flags: one or more of the ahtOFN_* constants, OR'd together.' InitialDir: the directory in which to first look' Filter: a set of file filters, set up by calling' AddFilterItem. See examples.' FilterIndex: 1-based integer indicating which filter' set to use, by default (1 if unspecified)' DefaultExt: Extension to use if the user doesn't enter one.' Only useful on file saves.' FileName: Default value for the file name text box.' DialogTitle: Title for the dialog.' hWnd: parent window handle' OpenFile: Boolean(True=Open File/False=Save As)' Out:' Return Value: Either Null or the selected filenameDim OFN As tagOPENFILENAMEDim strFileName As StringDim strFileTitle As StringDim fResult As Boolean ' Give the dialog a caption title. If IsMissing(InitialDir) Then InitialDir = CurDir If IsMissing(Filter) Then Filter = "" If IsMissing(FilterIndex) Then FilterIndex = 1 If IsMissing(Flags) Then Flags = 0& If IsMissing(DefaultExt) Then DefaultExt = "" If IsMissing(fileName) Then fileName = "" If IsMissing(DialogTitle) Then DialogTitle = "" If IsMissing(hwnd) Then hwnd = Application.hWndAccessApp If IsMissing(OpenFile) Then OpenFile = True ' Allocate string space for the returned strings. strFileName = left(fileName & String(256, 0), 256) strFileTitle = String(256, 0) ' Set up the data structure before you call the function With OFN .lStructSize = Len(OFN) .hwndOwner = hwnd .strFilter = Filter .nFilterIndex = FilterIndex .strFile = strFileName .nMaxFile = Len(strFileName) .strFileTitle = strFileTitle .nMaxFileTitle = Len(strFileTitle) .strTitle = DialogTitle .Flags = Flags .strDefExt = DefaultExt .strInitialDir = InitialDir ' Didn't think most people would want to deal with ' these options. .hInstance = 0 '.strCustomFilter = "" '.nMaxCustFilter = 0 .lpfnHook = 0 'New for NT 4.0 .strCustomFilter = String(255, 0) .nMaxCustFilter = 255 End With ' This will pass the desired data structure to the ' Windows API, which will in turn it uses to display ' the Open/Save As Dialog. If OpenFile Then fResult = aht_apiGetOpenFileName(OFN) Else fResult = aht_apiGetSaveFileName(OFN) End If ' The function call filled in the strFileTitle member ' of the structure. You'll have to write special code ' to retrieve that if you're interested. If fResult Then ' You might care to check the Flags member of the ' structure to get information about the chosen file. ' In this example, if you bothered to pass in a ' value for Flags, we'll fill it in with the outgoing ' Flags value. If Not IsMissing(Flags) Then Flags = OFN.Flags ahtCommonFileOpenSave = TrimNull(OFN.strFile) Else ahtCommonFileOpenSave = vbNullString End IfEnd Function

View 5 Replies View Related

Modules & VBA :: How To Browse Files And Store Them To Database

Jun 10, 2015

i want to browse the files from a form and then store hem to the database.i have the following code, i can show the file path to the text box but i don't know how to store the file or how to upload the file to the database.

Dim f As Object
Dim strFile As String
Dim strFolder As String
Dim varItem As Variant

[code]....

View 5 Replies View Related

Forms :: Allow User To Browse Path And Select File?

Jan 8, 2014

In my database i wanna use the DoCmd.CopyObject command with a button like as

DoCmd.CopyObject "Destination path can be browse and select file", "AcInformation", acTable, "AcInformation"

Image of the plane:

how can do this?

View 1 Replies View Related

Modules & VBA :: Import Multiple Files To Multiple Tables On Button Click

Sep 20, 2014

I made a database that in one of the forms, I like by clicking on a button the user be able to select 5 excel files with different file names (in the same directory) and then based on the imported file's names, it be stored in 5 different tables.

At the moment by using the bellow code, I can import multiple files (with the same formats) only into one table . My vba code comes as follow:

Function GetAllFiles()
Dim fd As Object
Dim strFilter As String
Dim lngItems As Long

Const msoFileDialogOpen As Long = 3
Const msoFileDialogViewDetails As Long = 2

[Code] ....

View 4 Replies View Related

Modules & VBA :: Import Multiple Fix Width Text Files - Eliminate Multiple Headers And Footers

Aug 1, 2013

I am trying to build a newer database 2010, based on an older one,2000, that has been locked tight and I cannot see the modules to kinda get a reference of where to start. I am trying to find a VBA code that will allow me to import a several text files to one table. The text files are all in the same format but I cannot remove the page headers and footers to get the table to look right. I have attached an example of the text file i am trying to import but it is a stripped down version for information protection.

Also, it appears in the old Database Table once imported as:

J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date

If I could import the text files and end up with a table like this, it would be all i need as i could run all the queries i need from this.

View 3 Replies View Related

How To List Multiple Files In Multiple Subfolders

Nov 14, 2005

Does anyone out there know how I might do the following:

I have a main folder which contains many sub-folders. In turen, each subfolder contains several files. I am interested in creating a text file that within each sub-folder will list certain files in that sub-folder. Example:

"Main Folder"
"Sub-folder 1"
FileA
FileB
FileZ
"Sub-folder 2"
FileA
FileB
"Sub-folder 3"
FileA
FileB
FileZ

Pseudo-code:

Read Main Folder
Do While Sub-folders exist
Do while selected sub-folder contains files
If selected sub-folder contians FileZ then
Write selected sub-folder name to text file
Write time/date stamp to text file
else
loop to next ub-folder
end if
end do while
end do while
Close input and output

Any help offered is greatly welcome. Thank you!!

View 7 Replies View Related

Modules & VBA :: SQL - Select Multiple Fields From Multiple Unrelated Tables

Oct 28, 2013

A small issue I was wondering of for a few day . Is it possible in SQL query to SELECT multiple fields from multiple tables ? Example for the question is

Code:

dim my_var as String
my_var = "SELECT Emp_FName , Emp_LName , Emp_Adress " _
& " FROM Table1 " _
& " AND Emp_Date_Of_Payment , Emp_Sum_Of_Payment " _
& "FROM Table2 " _
& " WHERE Emp_ID = 3 "

Is this code actually valid in SQL gramatics , and is it usable if passed to a Recordset variable ( rs = CurrentDB.OpenRecordset(my_var) ) ? Just FYI - The two tables are not related and I want to keep them that way (If possible relate their records just via SQL/Vba )

View 7 Replies View Related

Email Multiple Files

Jan 30, 2008

I think this was covered a while back and I did a search and couldn't find anything on it; Is there a way to attach and send multiple report .snp's to one email. I've been using SendObject.

thanks -

View 14 Replies View Related

Multiple Files Into One Table

Jan 7, 2005

Hi, I'm new to Access, but I think I've been doing fairly well. At my job, we use multiple Word tables and excel spreadsheets to keep track of information on journals we subscribe to. (I work in the periodicals/serials department of the university library.) We have a LOT of journals and a lot of information on each one.

I have already imported our "superholdings" file, which includes the names of the journals and a few bits of information on each one. What I want to do is import other bits of information from the other files into that same table. I tried importing the files into the existing table, but rather than merging all of the data for each journal title, it simply added the new records to the bottom. I tried importing the files as new tables and joining the tables with the title fields, but that didn't do what I wanted.

Really, I just want to merge all of the data. If the Title's match exactly, then I want all of that information in one record for that title. I have been VERY consistent with field names.

I'm new to Access, but I learn fairly quickly. I notice on this forum (I've read a LOT of the posts looking for answers to this question, and got answers for other questions) that most of the solutions involve coding or programming of some sort. I have NEVER done this in access. If the solution to my problem involves this, please tell me where I'm supposed to type those commands. I'm somewhat familiar with softcode (from a mux (talker environment) I started frequenting in college), but never have programmed anything. (Not since basic on our old IBM XT!!)

Okay, an example is forthcoming, once I figure out how to do it in this little window.


Thanks,
Siena

View 8 Replies View Related

Export To MULTIPLE CSV Files

Mar 10, 2008

Hello All,
I am trying to export a query to multiple .csv files.. For example...

Export1.csv = rows 1-1500
Export2.csv = rows 1501-3000
Export3.csv = rows 3001-4500

and so on until all rows have been exported...

Anyone have any idea what the best way to approach this is?

I'm sure many people will find this usefull because some exports can be over the 65000 limit of ms excel.

View 4 Replies View Related

Merging Multiple MDB Files Into One

Apr 4, 2014

We've got a software that is creating a mdb file with one table and 10 columns. Every day we have around 30.000 entries in the table. At the end of the week we have 7 different mdb files and usually we copy/paste them into one single file to do the base research. Everything is fine until the mdb's file size is 2GB. I understand that mdb files start behaving strange with files over 2GB of size. Therefore after a couple of months we have several 2GB mdb files. When doing a history research we have to open each and every file to check and search in that file. That can take a lot of time if you have 20 or more mdb files.

What I am asking is ... if there is a possibility to merge all the 2GB files into one or maybe more so that the research wouldn't take so much time.

View 2 Replies View Related

Importing Multiple Csv Files Into Table

Jul 19, 2005

I have been given the task of setting up a database which will store data which I will receive on a month basis, I have managed to import some csv files however, I will be receiving well over 200 csv files each month. Is there a way to import these multiple file.

The filename save structure is as follows: areacode-Jul 05data.csv

areacode represents each different area.

below is a copy of the csv file.....

View 2 Replies View Related

Multiple Access To Linked .txt Files?

Feb 8, 2006

We've had a problem for quite a while with regards to multiple users being able to view/run, queries/reports at the same time.
If someone is running a query/report, and then someone attempts to use any other query/report that’s already using the linked .txt file they get the error message:

The Microsoft Jet database engine cannot open the file ". It is already opened exclusively by another user, or you need permission to view its data.


I've read various posts with regards to user rights to the folder which the DB is stored, which isn't the problem in this case (we have tested and set user access to all read, write, delete etc).

I've also read that .txt files are managed in a different way than most other file types, in that DOS controls user access rather than jet?

So my question is:
Is there a way round this issue with linked tables that use .txt file as there source?

Thanks

Darren

View 2 Replies View Related

Import Multiple .csv Files To Access

Mar 3, 2006

Hi I have a few .csv files that i would like to upload into an access db. I saw an example for DTS, but since i dont have sql server i can't go that route.

Since i have some .csv Files where the file name changes on a daily basis, is it possible to upload them all with some wild card function. there is already a table with the fields already predetermined, and all i basically have to do is just load them all up at once.

please let me know if you have a solution.

View 2 Replies View Related

Importing Multiple Text Files

Aug 1, 2006

I am trying to import several txt from a directory.

The following code is on a button in a form:

Private Sub ImportData_Click()

Dim myfile
Dim mypath

mypath = "G:FinanceAccountingRoyalty2006exports3rd QTR 06JUL 06 est"
Do
myfile = Dir(mypath & "*.txt")
DoCmd.TransferText acImportFixed, "import_data", "tbl_import_tables", mypath & myfile, False, ""
myfile = Dir
Loop Until myfile = ""

End Sub

The problem is this causes a infinite loop

Can anyone help?? Thanks

PS This code was from previous posting, where the transfer was excel files.

View 5 Replies View Related

Import Multiple Excell Files

Jan 16, 2008

Super new to the forums and hoping I can find an answer here.
After looking for an hour or so on Microsoft's site, I gave up and decided to venture into new resources.

My ultimate goal is to create a form that will prompt a user to select a Microsoft Excel file and then run a macro. The macro should import the Excel file into a single table based off of what form is being run. The idea is to have a single form for each employee of a specific department and have the form import information that is stored on our phone server into access. I've set up most of the macro but the argument section of the filename is what's hanging me up.

So finally my question;
Is there a way to have a macro run to specify what file you want to import when using an additional macro? Am I going about this the completely wrong way and should stick to VB Code?

I look forward to your responses, thank you in advanced!

View 4 Replies View Related

Modules & VBA :: FTP Multiple Files Using Loop

May 15, 2014

Basically what I am trying to accomplish is uploading multiples file automatically into server. The code I am trying to use works great if the user wants to upload a single file manually because the code prompts you to choose the file and I am wondering if there is a way to tweak the code. here is the code I am using

Code:
Private Sub Form_Load()
Dim objFTP As FTP
Dim strfile As String

[Code].....

View 3 Replies View Related

Modules & VBA :: Printing To Multiple PDF Files

Jul 8, 2013

My report has tens of pages and I need to save each page as separate file with ID as filename. PDF prints with ID but all in one file. I use this code.

Option Compare Database
Private Sub tisk()
Dim cesta As String
Dim kod As String
Dim Sql As String
Dim rs As Recordset

[Code] ....

View 5 Replies View Related

Automate Import Of Multiple DBF Files

Sep 7, 2013

I've been asked importing about 50 - 60 .DBF files into an Access database daily - and processing the data in Access to specs I don't have yet.

I'm pretty comfortable doing whatever once I have the data in the Access Database.

View 8 Replies View Related

Can I Batch Import Multiple Excel Files?

Jun 22, 2007

I have 100 or so 2-sheet excel workbooks. I need to import them all into an access table for analysis. They are all exactly the same format/layout etc but obviously have different data in them (they are customer satisfaction surveys). I only want to export 1 out of the 2 sheets on each workbook (the other is a front end, the data sits behind in sheet 2).

So, at the moment I have to go to 'get external data' > 'import' > select excel and then double click each file individually and then go through the import wizard. Now, I can get them all into one table but it's clearly time consuming.

Is there anyway of doing a batch import of multiple excel files to cut out the manual work described above? Or can anyone suggest a lateral get around?

Any help much appreciated. I should say that I am running excel 2003 and access XP (2002)

Matt

View 5 Replies View Related

Exporting Multiple Csv Files From A Single Table

Mar 19, 2008

Hi guys. I'm a bit of a noob with Access. I have a table which is 15 rows by 250,000 columns. So there are about 3.75m records.

What I need to do is to get access to export a number of csv files automatically from this table.

I need each csv file to contain all the data in the table for a certain range of rows. This is determined by a value in a particular column. This is a sample of the table.

http://i30.tinypic.com/aljf5s.jpg


Basically Store_Nbr represents a UID for a particular store. All the data is currently in one big table, and I need a single csv file for each different store_nbr (so it contains all the data in the table for each unique store). Also, for each store_nbr, there are different Year Month of Surveys. For each store_nbr, I need a different csv file for each Year Month of Survey. This will probably divide up the 250,000 long table into about 200 csv files, as there are about 50 different Store_nbrs, and there are 4 surveys for each individual store.

Sorry if I've not made myself perfectly clear.

I'm sure there's a simple way of doing it, but I really do suck with access and was wondering if you guys had any idea.

Many many thanks!!!

Cheers

View 4 Replies View Related

Queries :: Import Multiple Excel Files

Jul 17, 2014

I have been trying to write a macro that will do the following:

- Look to a specific folder in my home drive (nb this may change)
- select all of the excel files that are in that folder
- select various cells in each of those spreadsheets - each spreadsheet is formatted the same with the same structure. The cells are random, e.g. D6, I22, H4, K4, D17, so I cannot select a whole range
- copy these cells and paste them into one row of a database

View 3 Replies View Related

Modules & VBA :: Importing Multiple Text Files?

Dec 17, 2013

Currently I have a code that imports a single text file into a table without problems.

I need to be able to selecte multiple text files and import them at once.

Here is my current working code.....

Code:
Private Sub Import_Click()
Dim strFilter As String
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Text File (*.txt)", "*.txt")
strSaveFileName = ahtCommonFileOpenSave( _
OpenFile:=True, _
Filter:=strFilter, _
DialogTitle:="Please select new file...", _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
DoCmd.TransferText acImportDelim, "Import Specs", "Data Table", strSaveFileName, True, ""

View 14 Replies View Related

Help: Pass Argument From Child Window To Parent Window?

Feb 15, 2005

Hi,

I have a parent window which upon clicking on a button will pop-up a child window containing a listbox. The listbox recordsource is a subset of the parent window. I want the user to select a record from the listbox which will load the selected record onto the parent window.

How does one pass argument back from child window to parent window?

From parent window to child window, I used
docmd.openform ,,,,,,[argument] and me.openargs in the child window

thanks in advance.

View 4 Replies View Related

Import Multiple Text Files Into Single Table

Dec 18, 2004

Hello everyone!

Here is my problem:
I have an Access database that contains a table with three columns (A & B & C). Field A is for code values and field B is for the value for that particular code. Field C holds the case number. I have a folder that contains the information for over 5000 case numbers. Each case number needs to be placed inside of the table. Considering there are 5000 case numbers, I dont want to use the import wizard 5000 times.

Furthermore, the text file only has two columns (for A and B).

I am trying to create a VBA that will append rows to the table by going into each file and placing the information into the table. The first row for each file contains the case number. So when the VBA runs, it should open the text file get the case number from the first row (field B on the text file) and place that in the case number field of the table for the entire file; and then repeat this action for all of the files in the entire folder.

Any help that can be provided will be greatly appreciated.

Thanks.

View 13 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved