OpenDatabase doesn't work in Access 2000 
Author Message
 OpenDatabase doesn't work in Access 2000

I have to import a textfile to a DB. The example function was found
at MSDN:
==========================
Sub OpenTextFile()
        Dim dbs As Database
        Dim rstAwards As Recordset
        ' Point to a folder that contains the text file you want to
open.
        Set dbs = OpenDatabase("C:\My Documents\Data", False,
False, "Text;")
        ' Create a Recordset object from the Awards text file.
        Set rstAwards = dbs.OpenRecordset("Awards.txt")
End Sub
============================
The problem is that this function works fine in Access'97, but in
Access'2000 I get an error message "No ISAM found".

Does anyone knows how to come around this problem.

Kind regards,
<Ralph>

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 13 Apr 2003 03:00:00 GMT  
 OpenDatabase doesn't work in Access 2000

By default, Access 2000 uses ADO. Your code is DAO. Open any code module (or
open the immediate window, using Ctrl-G). Select Tools | References from the
menu bar.

Find the DAO 3.6 reference, and select it. If you're not using ADO in your
application, you should unselect the reference to it while you're there.

If that doesn't solve the problem, post back.

--

Doug Steele, Microsoft Access MVP
Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://I.Am/DougSteele/


Quote:
> I have to import a textfile to a DB. The example function was found
> at MSDN:
> ==========================
> Sub OpenTextFile()
> Dim dbs As Database
> Dim rstAwards As Recordset
> ' Point to a folder that contains the text file you want to
> open.
> Set dbs = OpenDatabase("C:\My Documents\Data", False,
> False, "Text;")
> ' Create a Recordset object from the Awards text file.
> Set rstAwards = dbs.OpenRecordset("Awards.txt")
> End Sub
> ============================
> The problem is that this function works fine in Access'97, but in
> Access'2000 I get an error message "No ISAM found".

> Does anyone knows how to come around this problem.

> Kind regards,
> <Ralph>

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Sun, 13 Apr 2003 03:00:00 GMT  
 OpenDatabase doesn't work in Access 2000
I've imported dozens of text files, and this is what I do:
Import one manually, creating an Import Specification to get all the fields
right.

Typically, I then do the following in a module :

DoCmd.TransferText acImportDelim, _
"Customer Addresses Import Specification", _
"Customer Addresses Latest", "C:\Database\Oracle Reports\Customer
Addresses.txt", False

Customer Addresses Import Specification" is the spec file created in the
Import Wizard.
Customer Addresses Latest is the name of the Table that exists or must be
created.
Customer Addresses Latest.txt ... no guessing

All my files are Delimited. You can change that easily in the code, and just
retry.

If you want to create a recordset of the table, the following will do:
dim rst as Recordset
set rst = currentdb.dbs.OpenRecordset("Customer Addresses Latest")
or
...dim rst as Recordset
...dim dbs as Database (most often this is not necessary, but if you have
problems adding this might solve it)
...set dbs = CurrentDb (or whichever one)
...set rst = dbs.OpenRecordset("Customer Addresses Latest")


Quote:
> I have to import a textfile to a DB. The example function was found
> at MSDN:
> ==========================
> Sub OpenTextFile()
> Dim dbs As Database
> Dim rstAwards As Recordset
> ' Point to a folder that contains the text file you want to
> open.
> Set dbs = OpenDatabase("C:\My Documents\Data", False,
> False, "Text;")
> ' Create a Recordset object from the Awards text file.
> Set rstAwards = dbs.OpenRecordset("Awards.txt")
> End Sub
> ============================
> The problem is that this function works fine in Access'97, but in
> Access'2000 I get an error message "No ISAM found".

> Does anyone knows how to come around this problem.

> Kind regards,
> <Ralph>

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Tue, 15 Apr 2003 19:48:20 GMT  
 OpenDatabase doesn't work in Access 2000
Hi Doug.
Your advice helped to solve the problem, but I still have a question.

The real source of my trouble is that I developed a VB6 application
which converts a set of textfiles to a single MDB. The problem is that
my app.exe works fine on machines with Access'97 and halts on
Access'2000 machines. Since the problem lies in reference to either DAO
3.51 or DAO 3.6 I can't figure out how to make my app work in any
environment. I can't put both DAOs to reference in my VB6 app!!!
TIA,
<Ralph>



Quote:

> By default, Access 2000 uses ADO. Your code is DAO. Open any code
module (or
> open the immediate window, using Ctrl-G). Select Tools | References
from the
> menu bar.

> Find the DAO 3.6 reference, and select it. If you're not using ADO in
your
> application, you should unselect the reference to it while you're
there.

> If that doesn't solve the problem, post back.

> --

> Doug Steele, Microsoft Access MVP
> Beer, Wine and Database Programming. What could be better?
> Visit "Doug Steele's Beer and Programming Emporium"
> http://I.Am/DougSteele/



> > I have to import a textfile to a DB. The example function was found
> > at MSDN:
> > ==========================
> > Sub OpenTextFile()
> > Dim dbs As Database
> > Dim rstAwards As Recordset
> > ' Point to a folder that contains the text file you want to
> > open.
> > Set dbs = OpenDatabase("C:\My Documents\Data", False,
> > False, "Text;")
> > ' Create a Recordset object from the Awards text file.
> > Set rstAwards = dbs.OpenRecordset("Awards.txt")
> > End Sub
> > ============================
> > The problem is that this function works fine in Access'97, but in
> > Access'2000 I get an error message "No ISAM found".

> > Does anyone knows how to come around this problem.

> > Kind regards,
> > <Ralph>

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Thu, 17 Apr 2003 16:50:54 GMT  
 OpenDatabase doesn't work in Access 2000
If you don't know in advance whether your users will have DAO 3.5x or DAO
3.6, you'll need to use late binding. Include some code to determine which
version they have, and have alternate CreateObject statements, depending on
the version.

--

Doug Steele, Microsoft Access MVP
Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://I.Am/DougSteele/


Quote:
> Hi Doug.
> Your advice helped to solve the problem, but I still have a question.

> The real source of my trouble is that I developed a VB6 application
> which converts a set of textfiles to a single MDB. The problem is that
> my app.exe works fine on machines with Access'97 and halts on
> Access'2000 machines. Since the problem lies in reference to either DAO
> 3.51 or DAO 3.6 I can't figure out how to make my app work in any
> environment. I can't put both DAOs to reference in my VB6 app!!!
> TIA,
> <Ralph>



> > By default, Access 2000 uses ADO. Your code is DAO. Open any code
> module (or
> > open the immediate window, using Ctrl-G). Select Tools | References
> from the
> > menu bar.

> > Find the DAO 3.6 reference, and select it. If you're not using ADO in
> your
> > application, you should unselect the reference to it while you're
> there.

> > If that doesn't solve the problem, post back.

> > --

> > Doug Steele, Microsoft Access MVP
> > Beer, Wine and Database Programming. What could be better?
> > Visit "Doug Steele's Beer and Programming Emporium"
> > http://I.Am/DougSteele/



> > > I have to import a textfile to a DB. The example function was found
> > > at MSDN:
> > > ==========================
> > > Sub OpenTextFile()
> > > Dim dbs As Database
> > > Dim rstAwards As Recordset
> > > ' Point to a folder that contains the text file you want to
> > > open.
> > > Set dbs = OpenDatabase("C:\My Documents\Data", False,
> > > False, "Text;")
> > > ' Create a Recordset object from the Awards text file.
> > > Set rstAwards = dbs.OpenRecordset("Awards.txt")
> > > End Sub
> > > ============================
> > > The problem is that this function works fine in Access'97, but in
> > > Access'2000 I get an error message "No ISAM found".

> > > Does anyone knows how to come around this problem.

> > > Kind regards,
> > > <Ralph>

> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Thu, 17 Apr 2003 18:59:40 GMT  
 OpenDatabase doesn't work in Access 2000
Hi Allan.
Thanks for your advice, but it won't work in my case.
Unfortunately, I have to create MDB from the scratch, but not to fill
existing MDB containing predetermined specifications. Besides the
structure and content of imported text tables is unpredictable. So I
create Schema.ini to describe particular tables properties.
Regards,
<Ralph>



Quote:
> I've imported dozens of text files, and this is what I do:
> Import one manually, creating an Import Specification to get all the
fields
> right.

> Typically, I then do the following in a module :

> DoCmd.TransferText acImportDelim, _
> "Customer Addresses Import Specification", _
> "Customer Addresses Latest", "C:\Database\Oracle Reports\Customer
> Addresses.txt", False

> Customer Addresses Import Specification" is the spec file created in
the
> Import Wizard.
> Customer Addresses Latest is the name of the Table that exists or
must be
> created.
> Customer Addresses Latest.txt ... no guessing

> All my files are Delimited. You can change that easily in the code,
and just
> retry.

> If you want to create a recordset of the table, the following will do:
> dim rst as Recordset
> set rst = currentdb.dbs.OpenRecordset("Customer Addresses Latest")
> or
> ...dim rst as Recordset
> ...dim dbs as Database (most often this is not necessary, but if you
have
> problems adding this might solve it)
> ...set dbs = CurrentDb (or whichever one)
> ...set rst = dbs.OpenRecordset("Customer Addresses Latest")



> > I have to import a textfile to a DB. The example function was found
> > at MSDN:
> > ==========================
> > Sub OpenTextFile()
> > Dim dbs As Database
> > Dim rstAwards As Recordset
> > ' Point to a folder that contains the text file you want to
> > open.
> > Set dbs = OpenDatabase("C:\My Documents\Data", False,
> > False, "Text;")
> > ' Create a Recordset object from the Awards text file.
> > Set rstAwards = dbs.OpenRecordset("Awards.txt")
> > End Sub
> > ============================
> > The problem is that this function works fine in Access'97, but in
> > Access'2000 I get an error message "No ISAM found".

> > Does anyone knows how to come around this problem.

> > Kind regards,
> > <Ralph>

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Fri, 18 Apr 2003 16:00:23 GMT  
 OpenDatabase doesn't work in Access 2000
Hi Doug.
Unfortunately I never did that before :-((
Can you tell me in detail how to do this.
For now I can add references to my VB6 project only manually.
TIA,
<Ralph>



Quote:
> If you don't know in advance whether your users will have DAO 3.5x or
DAO
> 3.6, you'll need to use late binding. Include some code to determine
which
> version they have, and have alternate CreateObject statements,
depending on
> the version.

> --

> Doug Steele, Microsoft Access MVP
> Beer, Wine and Database Programming. What could be better?
> Visit "Doug Steele's Beer and Programming Emporium"
> http://I.Am/DougSteele/



> > Hi Doug.
> > Your advice helped to solve the problem, but I still have a
question.

> > The real source of my trouble is that I developed a VB6 application
> > which converts a set of textfiles to a single MDB. The problem is
that
> > my app.exe works fine on machines with Access'97 and halts on
> > Access'2000 machines. Since the problem lies in reference to either
DAO
> > 3.51 or DAO 3.6 I can't figure out how to make my app work in any
> > environment. I can't put both DAOs to reference in my VB6 app!!!
> > TIA,
> > <Ralph>



> > > By default, Access 2000 uses ADO. Your code is DAO. Open any code
> > module (or
> > > open the immediate window, using Ctrl-G). Select Tools |
References
> > from the
> > > menu bar.

> > > Find the DAO 3.6 reference, and select it. If you're not using
ADO in
> > your
> > > application, you should unselect the reference to it while you're
> > there.

> > > If that doesn't solve the problem, post back.

> > > --

> > > Doug Steele, Microsoft Access MVP
> > > Beer, Wine and Database Programming. What could be better?
> > > Visit "Doug Steele's Beer and Programming Emporium"
> > > http://I.Am/DougSteele/



> > > > I have to import a textfile to a DB. The example function was
found
> > > > at MSDN:
> > > > ==========================
> > > > Sub OpenTextFile()
> > > > Dim dbs As Database
> > > > Dim rstAwards As Recordset
> > > > ' Point to a folder that contains the text file you want to
> > > > open.
> > > > Set dbs = OpenDatabase("C:\My Documents\Data", False,
> > > > False, "Text;")
> > > > ' Create a Recordset object from the Awards text file.
> > > > Set rstAwards = dbs.OpenRecordset("Awards.txt")
> > > > End Sub
> > > > ============================
> > > > The problem is that this function works fine in Access'97, but
in
> > > > Access'2000 I get an error message "No ISAM found".

> > > > Does anyone knows how to come around this problem.

> > > > Kind regards,
> > > > <Ralph>

> > > > Sent via Deja.com http://www.deja.com/
> > > > Before you buy.

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Fri, 18 Apr 2003 16:24:14 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. An access 95 program doesn't work on access 2000

2. CreatQueryDef In Access 2000 Doesn't Work?

3. ADO Help doesn't work from within Access 2000

4. ADO Help doesn't appear (Access 2000, Windows 2000)

5. Win 2000 Offline files doesn't work with mdb

6. Why doesn't this code work on win 2000

7. Code doesn't work on windows 2000

8. Gettype for Windows 2000 doesn't work?

9. ListType Property doesn't work with Word 2000

10. GetOpenFileName32 doesn't work under Win 2000

11. How ironic, the HPC 2000 SDK Download page doesn't work

12. Program from access 97 won't work in access 2000

 

 
Powered by phpBB® Forum Software