Hi everyone, I am trying to get some specific values from a set of access databases, there is a file, within this file there are more than 100 folders, each folder contains 2 databases from which I am willing to import only 2 tables from one and 2 tables from the other, all 100 folders contain the same database structure only a different ID nr.
Until now I have been able to loop through the files and filter if the value on Field "F22" is "JA". Now I want to get the values from specific columns and loop these until there are no more values and continue with the next database.
Hope u understand what I mean, i am not a programmer and this is my first time working with VBA - Sub LoopThroughFilePaths()
-
Dim myArr
-
Dim i As Long
-
Dim j As Long
-
Dim MyFile As String
-
Dim Tablename As String
-
Dim Table1 As String
-
Dim Table2 As String
-
Dim Aktdb As DAO.Database
-
Dim AktVdb As DAO.Database
-
Dim AktRow
-
Dim rs1 As Recordset
-
Dim rs2 As Recordset
-
Dim Bez1 As Recordset
-
Dim Bez2 As Recordset
-
Dim strFeld As String
-
Dim intFeldPos As Integer
-
Const strPath As String = "C:\PATH..."
-
Table1 = "_Ist1"
-
Table2 = "_Ist2"
-
Counter = 0
-
myArr = GetSubFolders(strPath)
-
For j = 1 To UBound(myArr)
-
MyFile = Dir(myArr(j) & "\*.mdb")
-
'In myFile is the.mdb
-
Tablename = Replace(MyFile, ".mdb", "")
-
Set Aktdb = OpenDatabase(strPath + Tablename + "\" + MyFile)
-
Set AktVdb = OpenDatabase(strPath + Tablename + "\V" + MyFile)
-
Set rs1 = Aktdb.OpenRecordset("Ist1", dbOpenDynaset)
-
Set rs2 = Aktdb.OpenRecordset("Ist2", dbOpenDynaset)
-
Set Bez1 = AktVdb.OpenRecordset("Bez1", dbOpenDynaset)
-
Set Bez2 = AktVdb.OpenRecordset("Bez2", dbOpenDynaset)
-
Do While Not rs1.EOF
-
strFeld = rs1![F22]
-
intFeldPos = InStr(strFeld, "Ja")
-
If intFeldPos > 0 Then
-
strFeld = Replace(strFeld, " ", "")
-
'MsgBox "Found"
-
Else
-
intFeldPos = InStr(strFeld, "Nein")
-
If intFeldPos > 0 Then
-
strFeld = Replace(strFeld, " ", "")
-
'MsgBox "notfound"
-
Exit Sub
-
End If
-
End If
-
If strFeld = "Ja" Then
-
-
-
-
-
End If
-
rs1.MoveNext
-
Loop
4 1060
"Now I want to get the values from specific columns and loop these until there are no more values and continue with the next database. Hope u understand what I mean,"
No, I don't understand what you mean. What does "loop these" mean? You already have the looping through the rows down okay.
What are the "specific columns" you are interested in? What do you want to do with them?
Also, - For j = 1 To UBound(myArr)
should be - For j = 0 To UBound(myArr)-1
because the first element of an array is (0) unless you declare it differently.
Please use the [Code/] button to put any vba code in between Code tags for easier reading.
Jim
Hi thanx for the reply, the specific columns are in Database1(Aktdb): table Ist1 F1-F22, from table Ist2 column f51-f64
and Database2(AktVdb): from Table Bez1 F1-F22 and Bez2 Column F51-F64
I want to have all the information read from those folders merged into one only database having a table pro folder
It's not very clear to me what exactly you want. But the way to move data from one recordset to another is like this: - rs1.edit
-
rs1!fieldname = rs2!fieldname
-
rs1!fieldname2 = rs2!fieldnamewhatever
-
....
-
rs1.update
-
Jim
Thank you! I will try to make it work, I'll keep you posted.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Greg |
last post by:
Hello,
I've to manage many 'table' (having same scheme) on the same server.
And I ask myself what could be the best to do (and if you know, why) :
Creating as many database (the name would...
|
by: Matthias HALDIMANN |
last post by:
When importing data into MS SQL Server 2000 from a MyODBC (v3.51) data
source using Data Transformation Services, special characters like öäüéàè
are not imported correctly. However, when the MyODBC...
|
by: mike |
last post by:
Hi,
I am trying to determine what the overhead is per database in SQL
Server 2000 Standard. I have the option to put several customers in one
database, or give each customer their own database....
|
by: James Moe |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I have an old-ish Sybase dbms (SQL Anywhere v5.x) that does not offer a DUMP command.
The only way to extract data is to SELECT all of it,...
|
by: Dirk Olbertz |
last post by:
Hi there,
I'm currently about to redesign a database which you could compare with a
database for managing a library. Now this solution will not only manage one
library, but 100 to 500 of them....
|
by: jnikle |
last post by:
I have a database in A2003 format that's giving me this error, but it's
not the same situation I've been reading about on here. In my
development copy, I have imported copies of the backend's...
|
by: Sam Alexander |
last post by:
Hi Everone,
I'm writing a script to import data from an XML file, and this tutorial is
really an awesome guide :
http://www.kbalertz.com/Q316005/Import.Server.Component.aspx ... problem
though...
|
by: Mike Collins |
last post by:
I am importing a XML file and have not been having the best of luck in doing
this, but I do have the following solution below. I will not be importing
more than 2000 records at a time, but will be...
|
by: ScardyBob |
last post by:
Hello,
I am having trouble importing data from an Excel Worksheet. When I try
to import the data, everything works except certain columns that
contain dates, where it replaces the date with a...
|
by: mukeshsrivastav |
last post by:
dear sir
i want to move form excel to access.
i have 5 excel file having same formats and fields.now i want to import all data in one access table.
importing one file is easy .but importing and...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |