Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to convert Paradox Table into Access mdb file with VB?

Posted on 2006-10-25
21
Medium Priority
?
534 Views
Last Modified: 2013-12-25
Being totally ignorant, I need a complete solution here:

A [VB] script, macro, program or whatever they call it, that can be run with a command line parameter - a path to Paradox table and afterwards open that very table. Essentially I need to programatically open a Paradox table as if I called File->Open within Access, set the filter to Paradox (*.db), selected the file and opened it. I noticed that whenever a Paradox table is open, MS Access creates a respective mdb file containing the data of the original table, so I suppose I just need to open the Paradox table in order to convert it to mdb.

Thank you!
0
Comment
Question by:podoboq
  • 12
  • 8
21 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 17803122
ok, I know u said VB, but as a alternative, here are some paid solutions

1) there is this s/w called ABC Amber Paradox Converter. That might help u. Convert your tables to csv then import this csv into MSAccess

2) A more expensive utility http://www.ozgrid.com/Services/sql-server-database-convert.htm
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17803174
ok, yet another non command line alternative

I read somewhere that there is a builtin paradox converter that comes with Access. Its in the data access pack folder ValuPack\DataAcc
I dont know if this can be used on the command line or not


Now I dont have Paradox but can u try this

1. Install ODBC drivers and setup a DSN to your Paradox database
2. Use ADO or something to read the Paradox tables, then write that data into Access
0
 

Author Comment

by:podoboq
ID: 17803243
well, ODBC is not an option for me, as well as ABC Amber Convertor (its a handy tool though). Where should I search for this data access pack folder?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:podoboq
ID: 17803283
Isnt there some simple way of calling Access with a macro name or something that just open a given paradox table?  I have to call this from within another program so command line or some other clever way of passing an argumant is a must
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17803395
The pack should be on the CD, office CD I believe
u might even be able to download from the MS website
0
 

Author Comment

by:podoboq
ID: 17805650
okay, anyone?
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17810083
Was the converter on the office cd any good?

Pity u cant use ODBC as that would solve a lot of your problems I think.
0
 

Author Comment

by:podoboq
ID: 17810308
>Was the converter on the office cd any good?
Well, i find this ValuPack\DataAcc for Office 97 on ms site but they dont mention any paradox cobverter.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17810405
ok, try this
how good is your ADO knowledge
Ive found a connection string that u may be able to use. I dont have Paradox so I cant test it
Ive then taken this connection string and built a simple loop, looping thru one table

Assumption: the database to be in C:\dbpath\



dim adoConn as New ADODB.Connection
dim adoRS as ADODB.Recordset


ON Error Resume Next

Err.Clear
'Note: There is an extra space after "db" in the Paradox Driver name, has to be that way
adoConn.Open "Driver={Microsoft Paradox Driver (*.db )};" & _
                      "DriverID=538;" & _
                      "Fil=Paradox 5.X;" & _
                      "DefaultDir=c:\dbpath\;" & _
                      "Dbq=c:\dbpath\;" & _
                      "CollatingSequence=ASCII"
if err.number <> 0 then
    msgbox "Connection Failure. " & err.Description
else
    set adoRS = New ADODB.Recordset
    adoRS.Open "SELECT * FROM somtable", adoConn, adOpenStatic, adLockPessimistic
    do while adoRS.EOF = False
        debug.print adoRS.Fields(0).Name, adoRS.Fields(0).Value
        adoRS.MoveNext
    loop
    adoRS.Close
    set adoRS = Nothing
    adoConn.CLose
end if
set adoCOnn = Nothing



0
 

Author Comment

by:podoboq
ID: 17817535
ok, how to pass the path to the table as an argument?
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17817541
adoConn.Open "Driver={Microsoft Paradox Driver (*.db )};" & _
                      "DriverID=538;" & _
                      "Fil=Paradox 5.X;" & _
                      "DefaultDir=" & sDB & ";" & _
                      "Dbq=" & sDB & ";" & _
                      "CollatingSequence=ASCII"

sDB is the variable
0
 

Author Comment

by:podoboq
ID: 17818067
I mean, how to execute the macro with the path to the table as a command line argument. Is this possible?
0
 
LVL 11

Expert Comment

by:leclairm
ID: 17818534
Yes it is possible.  Use the Command$ variable in vb.

Let's say your compiled code is ConvertTables.exe, you would call it like this:

c:\ConvertTables.exe c:\Paradox\Tables\

Now, in your vb code, Command$ will contain "c:\Paradox\Tables\"
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17820399
As leclairm has said, use Command

here is a pictorial tutorial to help u
http://www.vbexplorer.com/VBExplorer/vb_feature/august2000/command_line_arguments.asp
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17820427
And if u wanted multiple command line arguments, its easier if I just show u a link with code examples
http://www.codeguru.com/vb/gen/vb_misc/tips/article.php/c2735/

Now with u asking this, can I assume that the code I posted earlier about opening via ado is working ?
0
 

Author Comment

by:podoboq
ID: 17832103
ekhem, really sorry, when I said VB, I meant VBA. Shall this work with VBA as well?
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17832427
similar

In order to use command line parameters with MSAccess/VBA, u need to pass in using /cmd (http://support.microsoft.com/kb/209207)

Then in code u can use Command

0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17833467
Did that help then?

Did the ODBC connection to Paradox example code help you any?

Im guessing u are passing the name of the paradox database in

That example code, changed to using a variable

adoConn.Open "Driver={Microsoft Paradox Driver (*.db )};" & _
                      "DriverID=538;" & _
                      "Fil=Paradox 5.X;" & _
                      "DefaultDir=" & sDB & ";" & _
                      "Dbq=" & sDB & ";" & _
                      "CollatingSequence=ASCII"


Simply validate Command and set sDB to Command

sDB = Command

then try it
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17837565
One question, u mentioned VBA, but question says VB
Are u using Access VBA?

If so then perhaps u could of used DoCmd.TransferDatabase

See this list as Paradox is a supported type

http://www.blueclaw-db.com/transferdatabase-docmd.htm
0
 

Author Comment

by:podoboq
ID: 17841135
Thank you very much for your time and efforts, rockiroads! That sounds very helpful. Indeed, im using Access VBA. Probably this thread was not the best place to post this question in. Anyway, the only thing left is to code the macro itself:) Can I write a standalone script that does the conversion, or rather have some "database" open and attach the macro to it or what? Being quite unfamiliar with Access and VBA I'm somewhat confused and dont know how to start off.
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 2000 total points
ID: 17841186
no probs

first I need to know what code u are planning to use?

If u want to use TransferDatabase and wish to use it in VBS, u can do something like this

    Dim acc
   
    Set acc = CreateObject("Access.Application")
    acc.OpenCurrentDatabase ("C:\EE\mydb.mdb")
    acc.DoCmd.TransferDatabase ...... THE REST OF THE LINE
    acc.CloseCurrentDatabase
    Set acc = Nothing



But first u need to verify that u can get TransferDatabase working

So if u can get whatever code u want working in VBA first, we then take it from there


0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

971 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