By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,818 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,818 IT Pros & Developers. It's quick & easy.

CompactDatabase fails with Invalid Argument error

P: n/a
Hello.

For years I've been using the DBEngine.CompactDatabase code to make
backups of backend databases. But now I've struck a baffling problem
where I get an Invalid Argument error. This happens on an XPHome machine
with both A97 and A2000 installed.

I simplified the code and the error still occurs. In the following new
test database containing only this procedure, dbSource refers to a brand
new database with no objects which is closed. dbDest does not yet exist.
On the last line I get the error message 'Invalid Argument'. The same
happens if I leave the dbLangGeneral out.

Dim dbSource As String, dbDest As String

dbSource = "C:\oj\aa\development\DBSource.mdb"
dbDest = "C:\oj\aa\development\DBDest.mdb"

DBEngine.CompactDatabase dbSource, dbDest, dbLangGeneral

Any suggestions?
Owen Jenkins
Nov 12 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
I've since found that this problem is related to having A97 and A2000 on the
same machine. The compact process works OK in A2000 on a machine with only
A2000, and works OK in A97 on a machine with only A97. It also works OK in
A2000 on a machine with both A97 and A2000, but on the same machine, it
doesn't work in A97.

So having A2000 on the same machine, prevents the A97 compact process
working.

Any ideas why? It doesn't appear to be a references issue.

Owen

Owen Jenkins wrote:
Hello.

For years I've been using the DBEngine.CompactDatabase code to make
backups of backend databases. But now I've struck a baffling problem
where I get an Invalid Argument error. This happens on an XPHome machine
with both A97 and A2000 installed.

I simplified the code and the error still occurs. In the following new
test database containing only this procedure, dbSource refers to a brand
new database with no objects which is closed. dbDest does not yet exist.
On the last line I get the error message 'Invalid Argument'. The same
happens if I leave the dbLangGeneral out.

Dim dbSource As String, dbDest As String

dbSource = "C:\oj\aa\development\DBSource.mdb"
dbDest = "C:\oj\aa\development\DBDest.mdb"

DBEngine.CompactDatabase dbSource, dbDest, dbLangGeneral

Any suggestions?

Owen Jenkins


Nov 12 '05 #2

P: n/a
I duggest you go to your debug (immediate) window and type the following:

? dbLangGeneral

And tell me what it says there.
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Owen Jenkins" <oj@healthbase.com.au> wrote in message
news:3F***************@healthbase.com.au...
I've since found that this problem is related to having A97 and A2000 on the same machine. The compact process works OK in A2000 on a machine with only
A2000, and works OK in A97 on a machine with only A97. It also works OK in
A2000 on a machine with both A97 and A2000, but on the same machine, it
doesn't work in A97.

So having A2000 on the same machine, prevents the A97 compact process
working.

Any ideas why? It doesn't appear to be a references issue.

Owen

Owen Jenkins wrote:
Hello.

For years I've been using the DBEngine.CompactDatabase code to make
backups of backend databases. But now I've struck a baffling problem
where I get an Invalid Argument error. This happens on an XPHome machine
with both A97 and A2000 installed.

I simplified the code and the error still occurs. In the following new
test database containing only this procedure, dbSource refers to a brand
new database with no objects which is closed. dbDest does not yet exist.
On the last line I get the error message 'Invalid Argument'. The same
happens if I leave the dbLangGeneral out.

Dim dbSource As String, dbDest As String

dbSource = "C:\oj\aa\development\DBSource.mdb"
dbDest = "C:\oj\aa\development\DBDest.mdb"

DBEngine.CompactDatabase dbSource, dbDest, dbLangGeneral

Any suggestions?

Owen Jenkins

Nov 12 '05 #3

P: n/a
? dbLangGeneral gives me

;LANGID=0x0409;CP=1252;COUNTRY=0

It's the same on all my machines (W95/A97, Win98/A2000, WinXPH/A97/A2000).

Owen

"Michael (michka) Kaplan [MS]" wrote:
I duggest you go to your debug (immediate) window and type the following:

? dbLangGeneral

And tell me what it says there.

--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.

"Owen Jenkins" <oj@healthbase.com.au> wrote in message
news:3F***************@healthbase.com.au...
I've since found that this problem is related to having A97 and A2000 on

the
same machine. The compact process works OK in A2000 on a machine with only
A2000, and works OK in A97 on a machine with only A97. It also works OK in
A2000 on a machine with both A97 and A2000, but on the same machine, it
doesn't work in A97.

So having A2000 on the same machine, prevents the A97 compact process
working.

Any ideas why? It doesn't appear to be a references issue.

Owen

Owen Jenkins wrote:
Hello.

For years I've been using the DBEngine.CompactDatabase code to make
backups of backend databases. But now I've struck a baffling problem
where I get an Invalid Argument error. This happens on an XPHome machine
with both A97 and A2000 installed.

I simplified the code and the error still occurs. In the following new
test database containing only this procedure, dbSource refers to a brand
new database with no objects which is closed. dbDest does not yet exist.
On the last line I get the error message 'Invalid Argument'. The same
happens if I leave the dbLangGeneral out.

Dim dbSource As String, dbDest As String

dbSource = "C:\oj\aa\development\DBSource.mdb"
dbDest = "C:\oj\aa\development\DBDest.mdb"

DBEngine.CompactDatabase dbSource, dbDest, dbLangGeneral

Any suggestions?

Owen Jenkins


Nov 12 '05 #4

P: n/a
This parameter should be one of the dbSort constants, not one of the dbLang
constants (which are to be used only for database creation).
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Owen Jenkins" <oj@healthbase.com.au> wrote in message
news:3F***************@healthbase.com.au...
? dbLangGeneral gives me

;LANGID=0x0409;CP=1252;COUNTRY=0

It's the same on all my machines (W95/A97, Win98/A2000, WinXPH/A97/A2000).

Owen

"Michael (michka) Kaplan [MS]" wrote:
I duggest you go to your debug (immediate) window and type the following:
? dbLangGeneral

And tell me what it says there.

--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.

"Owen Jenkins" <oj@healthbase.com.au> wrote in message
news:3F***************@healthbase.com.au...
I've since found that this problem is related to having A97 and A2000 on
the
same machine. The compact process works OK in A2000 on a machine with

only A2000, and works OK in A97 on a machine with only A97. It also works OK in A2000 on a machine with both A97 and A2000, but on the same machine, it doesn't work in A97.

So having A2000 on the same machine, prevents the A97 compact process
working.

Any ideas why? It doesn't appear to be a references issue.

Owen

Owen Jenkins wrote:

> Hello.
>
> For years I've been using the DBEngine.CompactDatabase code to make
> backups of backend databases. But now I've struck a baffling problem
> where I get an Invalid Argument error. This happens on an XPHome machine > with both A97 and A2000 installed.
>
> I simplified the code and the error still occurs. In the following new > test database containing only this procedure, dbSource refers to a brand > new database with no objects which is closed. dbDest does not yet exist. > On the last line I get the error message 'Invalid Argument'. The same > happens if I leave the dbLangGeneral out.
>
> Dim dbSource As String, dbDest As String
>
> dbSource = "C:\oj\aa\development\DBSource.mdb"
> dbDest = "C:\oj\aa\development\DBDest.mdb"
>
> DBEngine.CompactDatabase dbSource, dbDest, dbLangGeneral
>
> Any suggestions?
>
> Owen Jenkins

Nov 12 '05 #5

P: n/a
Or better yet, do not even specify it unless you are trying to change the
collating order of the database.
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Michael (michka) Kaplan [MS]" <mi*****@online.microsoft.com> wrote in
message news:3f********@news.microsoft.com...
This parameter should be one of the dbSort constants, not one of the dbLang constants (which are to be used only for database creation).
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Owen Jenkins" <oj@healthbase.com.au> wrote in message
news:3F***************@healthbase.com.au...
? dbLangGeneral gives me

;LANGID=0x0409;CP=1252;COUNTRY=0

It's the same on all my machines (W95/A97, Win98/A2000, WinXPH/A97/A2000).

Owen

"Michael (michka) Kaplan [MS]" wrote:
I duggest you go to your debug (immediate) window and type the
following:
? dbLangGeneral

And tell me what it says there.

--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.

"Owen Jenkins" <oj@healthbase.com.au> wrote in message
news:3F***************@healthbase.com.au...
> I've since found that this problem is related to having A97 and A2000 on
the
> same machine. The compact process works OK in A2000 on a machine
with
only > A2000, and works OK in A97 on a machine with only A97. It also works OK in > A2000 on a machine with both A97 and A2000, but on the same machine, it > doesn't work in A97.
>
> So having A2000 on the same machine, prevents the A97 compact
process > working.
>
> Any ideas why? It doesn't appear to be a references issue.
>
> Owen
>
> Owen Jenkins wrote:
>
> > Hello.
> >
> > For years I've been using the DBEngine.CompactDatabase code to make > > backups of backend databases. But now I've struck a baffling problem > > where I get an Invalid Argument error. This happens on an XPHome

machine > > with both A97 and A2000 installed.
> >
> > I simplified the code and the error still occurs. In the following new > > test database containing only this procedure, dbSource refers to a brand > > new database with no objects which is closed. dbDest does not yet exist. > > On the last line I get the error message 'Invalid Argument'. The same > > happens if I leave the dbLangGeneral out.
> >
> > Dim dbSource As String, dbDest As String
> >
> > dbSource = "C:\oj\aa\development\DBSource.mdb"
> > dbDest = "C:\oj\aa\development\DBDest.mdb"
> >
> > DBEngine.CompactDatabase dbSource, dbDest, dbLangGeneral
> >
> > Any suggestions?
> >
> > Owen Jenkins
>


Nov 12 '05 #6

P: n/a
I'm not sure what you mean that it should be a dbSort constant. And the problem
occurs even if I don't include the dbLangGeneral parameter at all, that is
DBEngine.CompactDatabase dbSource, dbDest.

Owen

"Michael (michka) Kaplan [MS]" wrote:
Or better yet, do not even specify it unless you are trying to change the
collating order of the database.

--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.

"Michael (michka) Kaplan [MS]" <mi*****@online.microsoft.com> wrote in
message news:3f********@news.microsoft.com...
This parameter should be one of the dbSort constants, not one of the

dbLang
constants (which are to be used only for database creation).
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Owen Jenkins" <oj@healthbase.com.au> wrote in message
news:3F***************@healthbase.com.au...
? dbLangGeneral gives me

;LANGID=0x0409;CP=1252;COUNTRY=0

It's the same on all my machines (W95/A97, Win98/A2000, WinXPH/A97/A2000).
Owen

"Michael (michka) Kaplan [MS]" wrote:

> I duggest you go to your debug (immediate) window and type the

following:
>
> ? dbLangGeneral
>
> And tell me what it says there.
>
> --
> MichKa [MS]
> NLS Collation/Locale/Keyboard Development
> Globalization Infrastructure and Font Technologies
>
> This posting is provided "AS IS" with
> no warranties, and confers no rights.
>
> "Owen Jenkins" <oj@healthbase.com.au> wrote in message
> news:3F***************@healthbase.com.au...
> > I've since found that this problem is related to having A97 and A2000
on
> the
> > same machine. The compact process works OK in A2000 on a machine

with
only
> > A2000, and works OK in A97 on a machine with only A97. It also works

OK in
> > A2000 on a machine with both A97 and A2000, but on the same machine,

it
> > doesn't work in A97.
> >
> > So having A2000 on the same machine, prevents the A97 compact

process > > working.
> >
> > Any ideas why? It doesn't appear to be a references issue.
> >
> > Owen
> >
> > Owen Jenkins wrote:
> >
> > > Hello.
> > >
> > > For years I've been using the DBEngine.CompactDatabase code to make > > > backups of backend databases. But now I've struck a baffling problem > > > where I get an Invalid Argument error. This happens on an XPHome

machine
> > > with both A97 and A2000 installed.
> > >
> > > I simplified the code and the error still occurs. In the following

new
> > > test database containing only this procedure, dbSource refers to a

brand
> > > new database with no objects which is closed. dbDest does not yet

exist.
> > > On the last line I get the error message 'Invalid Argument'. The

same
> > > happens if I leave the dbLangGeneral out.
> > >
> > > Dim dbSource As String, dbDest As String
> > >
> > > dbSource = "C:\oj\aa\development\DBSource.mdb"
> > > dbDest = "C:\oj\aa\development\DBDest.mdb"
> > >
> > > DBEngine.CompactDatabase dbSource, dbDest, dbLangGeneral
> > >
> > > Any suggestions?
> > >
> > > Owen Jenkins
> >



--
Owen Jenkins
oj@healthbase.com.au
HealthBase Data Services
http://www.healthbase.com.au
PO Box 714, Randwick, NSW 2031
Tel & Fax: 61 2 9341 7792
-------------------------------------------
Nov 12 '05 #7

P: n/a
What I mean is that dbLangGeneral should only EVER be used during create.

Are you truly saying that the following code fails:

Dim dbSource As String
Dim dbDest As String

dbSource = "C:\oj\aa\development\DBSource.mdb"
dbDest = "C:\oj\aa\development\DBDest.mdb"

DBEngine.CompactDatabase dbSource, dbDest

How about if you change the last line to:

DAO.DBEngine.CompactDatabase dbSource, dbDest
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Owen Jenkins" <oj@healthbase.com.au> wrote in message
news:3F**************@healthbase.com.au...
I'm not sure what you mean that it should be a dbSort constant. And the problem occurs even if I don't include the dbLangGeneral parameter at all, that is
DBEngine.CompactDatabase dbSource, dbDest.

Owen

"Michael (michka) Kaplan [MS]" wrote:
Or better yet, do not even specify it unless you are trying to change the collating order of the database.

--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.

"Michael (michka) Kaplan [MS]" <mi*****@online.microsoft.com> wrote in
message news:3f********@news.microsoft.com...
This parameter should be one of the dbSort constants, not one of the

dbLang
constants (which are to be used only for database creation).
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Owen Jenkins" <oj@healthbase.com.au> wrote in message
news:3F***************@healthbase.com.au...
> ? dbLangGeneral gives me
>
> ;LANGID=0x0409;CP=1252;COUNTRY=0
>
> It's the same on all my machines (W95/A97, Win98/A2000,

WinXPH/A97/A2000).
>
> Owen
>
> "Michael (michka) Kaplan [MS]" wrote:
>
> > I duggest you go to your debug (immediate) window and type the
following:
> >
> > ? dbLangGeneral
> >
> > And tell me what it says there.
> >
> > --
> > MichKa [MS]
> > NLS Collation/Locale/Keyboard Development
> > Globalization Infrastructure and Font Technologies
> >
> > This posting is provided "AS IS" with
> > no warranties, and confers no rights.
> >
> > "Owen Jenkins" <oj@healthbase.com.au> wrote in message
> > news:3F***************@healthbase.com.au...
> > > I've since found that this problem is related to having A97 and

A2000
on
> > the
> > > same machine. The compact process works OK in A2000 on a machine

with
only
> > > A2000, and works OK in A97 on a machine with only A97. It also works OK in
> > > A2000 on a machine with both A97 and A2000, but on the same machine, it
> > > doesn't work in A97.
> > >
> > > So having A2000 on the same machine, prevents the A97 compact

process
> > > working.
> > >
> > > Any ideas why? It doesn't appear to be a references issue.
> > >
> > > Owen
> > >
> > > Owen Jenkins wrote:
> > >
> > > > Hello.
> > > >
> > > > For years I've been using the DBEngine.CompactDatabase code to

make
> > > > backups of backend databases. But now I've struck a baffling

problem
> > > > where I get an Invalid Argument error. This happens on an XPHome machine
> > > > with both A97 and A2000 installed.
> > > >
> > > > I simplified the code and the error still occurs. In the following new
> > > > test database containing only this procedure, dbSource refers to a brand
> > > > new database with no objects which is closed. dbDest does not yet exist.
> > > > On the last line I get the error message 'Invalid Argument'. The same
> > > > happens if I leave the dbLangGeneral out.
> > > >
> > > > Dim dbSource As String, dbDest As String
> > > >
> > > > dbSource = "C:\oj\aa\development\DBSource.mdb"
> > > > dbDest = "C:\oj\aa\development\DBDest.mdb"
> > > >
> > > > DBEngine.CompactDatabase dbSource, dbDest, dbLangGeneral
> > > >
> > > > Any suggestions?
> > > >
> > > > Owen Jenkins
> > >
>


--
Owen Jenkins
oj@healthbase.com.au
HealthBase Data Services
http://www.healthbase.com.au
PO Box 714, Randwick, NSW 2031
Tel & Fax: 61 2 9341 7792
-------------------------------------------

Nov 12 '05 #8

P: n/a
I'd love to report success with DAO.DBEngine, but alas, same error.

Yes, the exact code below fails on the last line with error 3001 - Invalid
argument.

The db with the code has only this code in it - no other modules. The dbSource
exists and is empty. The dbDest does not exist. I have references to VBA, Access
8.0 and DAO 3.51. I also have Access 2000 on the same machine, but double
clicking on an mdb file currently opens it in A97. The same setup works in
A2000.

Owen

"Michael (michka) Kaplan [MS]" wrote:
What I mean is that dbLangGeneral should only EVER be used during create.

Are you truly saying that the following code fails:

Dim dbSource As String
Dim dbDest As String

dbSource = "C:\oj\aa\development\DBSource.mdb"
dbDest = "C:\oj\aa\development\DBDest.mdb"

DBEngine.CompactDatabase dbSource, dbDest

How about if you change the last line to:

DAO.DBEngine.CompactDatabase dbSource, dbDest

--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.

"Owen Jenkins" <oj@healthbase.com.au> wrote in message
news:3F**************@healthbase.com.au...
I'm not sure what you mean that it should be a dbSort constant. And the

problem
occurs even if I don't include the dbLangGeneral parameter at all, that is
DBEngine.CompactDatabase dbSource, dbDest.

Owen

"Michael (michka) Kaplan [MS]" wrote:
Or better yet, do not even specify it unless you are trying to change the collating order of the database.

--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.

"Michael (michka) Kaplan [MS]" <mi*****@online.microsoft.com> wrote in
message news:3f********@news.microsoft.com...
> This parameter should be one of the dbSort constants, not one of the
dbLang
> constants (which are to be used only for database creation).
>
>
> --
> MichKa [MS]
> NLS Collation/Locale/Keyboard Development
> Globalization Infrastructure and Font Technologies
>
> This posting is provided "AS IS" with
> no warranties, and confers no rights.
>
>
> "Owen Jenkins" <oj@healthbase.com.au> wrote in message
> news:3F***************@healthbase.com.au...
> > ? dbLangGeneral gives me
> >
> > ;LANGID=0x0409;CP=1252;COUNTRY=0
> >
> > It's the same on all my machines (W95/A97, Win98/A2000,
WinXPH/A97/A2000).
> >
> > Owen
> >
> > "Michael (michka) Kaplan [MS]" wrote:
> >
> > > I duggest you go to your debug (immediate) window and type the
> following:
> > >
> > > ? dbLangGeneral
> > >
> > > And tell me what it says there.
> > >
> > > --
> > > MichKa [MS]
> > > NLS Collation/Locale/Keyboard Development
> > > Globalization Infrastructure and Font Technologies
> > >
> > > This posting is provided "AS IS" with
> > > no warranties, and confers no rights.
> > >
> > > "Owen Jenkins" <oj@healthbase.com.au> wrote in message
> > > news:3F***************@healthbase.com.au...
> > > > I've since found that this problem is related to having A97 and
A2000
> on
> > > the
> > > > same machine. The compact process works OK in A2000 on a machine
with
> only
> > > > A2000, and works OK in A97 on a machine with only A97. It also works > OK in
> > > > A2000 on a machine with both A97 and A2000, but on the same machine, > it
> > > > doesn't work in A97.
> > > >
> > > > So having A2000 on the same machine, prevents the A97 compact
process
> > > > working.
> > > >
> > > > Any ideas why? It doesn't appear to be a references issue.
> > > >
> > > > Owen
> > > >
> > > > Owen Jenkins wrote:
> > > >
> > > > > Hello.
> > > > >
> > > > > For years I've been using the DBEngine.CompactDatabase code to
make
> > > > > backups of backend databases. But now I've struck a baffling
problem
> > > > > where I get an Invalid Argument error. This happens on an XPHome > machine
> > > > > with both A97 and A2000 installed.
> > > > >
> > > > > I simplified the code and the error still occurs. In the following > new
> > > > > test database containing only this procedure, dbSource refers to a > brand
> > > > > new database with no objects which is closed. dbDest does not yet > exist.
> > > > > On the last line I get the error message 'Invalid Argument'. The > same
> > > > > happens if I leave the dbLangGeneral out.
> > > > >
> > > > > Dim dbSource As String, dbDest As String
> > > > >
> > > > > dbSource = "C:\oj\aa\development\DBSource.mdb"
> > > > > dbDest = "C:\oj\aa\development\DBDest.mdb"
> > > > >
> > > > > DBEngine.CompactDatabase dbSource, dbDest, dbLangGeneral
> > > > >
> > > > > Any suggestions?
> > > > >
> > > > > Owen Jenkins
> > > >
> >
>
>


--
Owen Jenkins
oj@healthbase.com.au
HealthBase Data Services
http://www.healthbase.com.au
PO Box 714, Randwick, NSW 2031
Tel & Fax: 61 2 9341 7792
-------------------------------------------


--
Owen Jenkins
oj@healthbase.com.au
HealthBase Data Services
http://www.healthbase.com.au
PO Box 714, Randwick, NSW 2031
Tel & Fax: 61 2 9341 7792
-------------------------------------------
Nov 12 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.