Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 539
  • Last Modified:

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

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
podoboq
Asked:
podoboq
  • 12
  • 8
1 Solution
 
rockiroadsCommented:
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
 
rockiroadsCommented:
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
 
podoboqAuthor Commented:
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!

 
podoboqAuthor Commented:
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
 
rockiroadsCommented:
The pack should be on the CD, office CD I believe
u might even be able to download from the MS website
0
 
podoboqAuthor Commented:
okay, anyone?
0
 
rockiroadsCommented:
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
 
podoboqAuthor Commented:
>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
 
rockiroadsCommented:
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
 
podoboqAuthor Commented:
ok, how to pass the path to the table as an argument?
0
 
rockiroadsCommented:
adoConn.Open "Driver={Microsoft Paradox Driver (*.db )};" & _
                      "DriverID=538;" & _
                      "Fil=Paradox 5.X;" & _
                      "DefaultDir=" & sDB & ";" & _
                      "Dbq=" & sDB & ";" & _
                      "CollatingSequence=ASCII"

sDB is the variable
0
 
podoboqAuthor Commented:
I mean, how to execute the macro with the path to the table as a command line argument. Is this possible?
0
 
leclairmCommented:
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
 
rockiroadsCommented:
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
 
rockiroadsCommented:
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
 
podoboqAuthor Commented:
ekhem, really sorry, when I said VB, I meant VBA. Shall this work with VBA as well?
0
 
rockiroadsCommented:
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
 
rockiroadsCommented:
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
 
rockiroadsCommented:
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
 
podoboqAuthor Commented:
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
 
rockiroadsCommented:
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

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 12
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now