DAO 3.5 object library vs. DAO 3.51 
Author Message
 DAO 3.5 object library vs. DAO 3.51

I have a program that works in Word and finds things in an
Access database.  It works fine on my computer, but on my
co-worker's computer, she gets an error message:

Wrong number of arguments or invalid property assignment.

If I click on Debug, it highlights this line of code:

Set DBWork=DBEngine.CreateWorkspace("", "Admin", "",
dbUseJet)

The only difference I can find is that I have Microsoft
DAO 3.5 object library selected in my reference libraries,
and my co-worker doesn't have this listed.  She has DAO
3.51, but that gives the above error.  (Incidentally, my
program works on another co-worker's computer and she has
DAO 3.5, too).  I also tried the Microsoft DAO 2.5/3.5
Compatibility Library and it didn't work.  So I contacted
our IT department to see if they could install the right
library for my co-worker, but they can't figure out how to
do it.  Can I change my program so that it works for both
3.5 and 3.51?  This is the whole subroutine:

'Look up the abbreviation in the database and display all
'the expansions in the Expansion text box.  If the
'expansion has not been verified, mark it with an
'asterisk.
Private Sub CheckDB_Click()
'Local variables
Dim AbbreviationDB As DAO.Database
Dim DBWork As Workspace
Dim AbbRecords As Recordset
Dim AbbSearchString As String, User As String

'Constants
Const dbPath As String = "H:\Writers Folders\z Common
Text\Abbreviations.mdb"

'Initializing variables
User = DBEngine.Workspaces(0).UserName
Set DBWork = DBEngine.CreateWorkspace("AbbrevWorkspace",
User, "", dbUseJet)
Set AbbreviationDB = OpenDatabase(dbPath, True)
Set AbbRecords = AbbreviationDB.OpenRecordset
("Abbreviations", _
    dbOpenSnapshot)

'Check that there is an abbreviation in the field
If AbbrField.Text = "" Then
    MsgBox "You must type an abbreviation in the
Abbreviation field."
Else
    'Retrieve definitions for the current abbreviation
    AbbSearchString = "Abbrev = '" & Trim(AbbrField.Text)
& "'"
    AbbRecords.FindFirst AbbSearchString
    If AbbRecords.NoMatch = False Then
        Do Until AbbRecords.NoMatch = True
            If AbbRecords!Verified = no Then
                Expansion.Text = "*" & AbbRecords!
Definition & vbCr & _
                    vbCr & Expansion.Text
            Else
                Expansion.Text = AbbRecords!Definition &
vbCr & vbCr & _
                    Expansion.Text
            End If
            AbbRecords.FindNext AbbSearchString
        Loop
    Else
        Expansion.Text = "Not Found"
    End If
End If

'Close out of database
AbbRecords.Close
AbbreviationDB.Close

End Sub



Sun, 12 Sep 2004 02:17:01 GMT  
 DAO 3.5 object library vs. DAO 3.51
Try changing the declarations so that all the DAO objects are declared
explicitly:

Dim AbbreviationDB As DAO.Database
Dim DBWork As DAO.Workspace
Dim AbbRecords As DAO.Recordset

The problem might be, not that the machine is using 3.51 instead of 3.5 (the
differences are minor) but a conflict with other definitions of these object
names.



Quote:
> I have a program that works in Word and finds things in an
> Access database.  It works fine on my computer, but on my
> co-worker's computer, she gets an error message:

> Wrong number of arguments or invalid property assignment.

> If I click on Debug, it highlights this line of code:

> Set DBWork=DBEngine.CreateWorkspace("", "Admin", "",
> dbUseJet)

> The only difference I can find is that I have Microsoft
> DAO 3.5 object library selected in my reference libraries,
> and my co-worker doesn't have this listed.  She has DAO
> 3.51, but that gives the above error.  (Incidentally, my
> program works on another co-worker's computer and she has
> DAO 3.5, too).  I also tried the Microsoft DAO 2.5/3.5
> Compatibility Library and it didn't work.  So I contacted
> our IT department to see if they could install the right
> library for my co-worker, but they can't figure out how to
> do it.  Can I change my program so that it works for both
> 3.5 and 3.51?  This is the whole subroutine:

> 'Look up the abbreviation in the database and display all
> 'the expansions in the Expansion text box.  If the
> 'expansion has not been verified, mark it with an
> 'asterisk.
> Private Sub CheckDB_Click()
> 'Local variables
> Dim AbbreviationDB As DAO.Database
> Dim DBWork As Workspace
> Dim AbbRecords As Recordset
> Dim AbbSearchString As String, User As String

> 'Constants
> Const dbPath As String = "H:\Writers Folders\z Common
> Text\Abbreviations.mdb"

> 'Initializing variables
> User = DBEngine.Workspaces(0).UserName
> Set DBWork = DBEngine.CreateWorkspace("AbbrevWorkspace",
> User, "", dbUseJet)
> Set AbbreviationDB = OpenDatabase(dbPath, True)
> Set AbbRecords = AbbreviationDB.OpenRecordset
> ("Abbreviations", _
>     dbOpenSnapshot)

> 'Check that there is an abbreviation in the field
> If AbbrField.Text = "" Then
>     MsgBox "You must type an abbreviation in the
> Abbreviation field."
> Else
>     'Retrieve definitions for the current abbreviation
>     AbbSearchString = "Abbrev = '" & Trim(AbbrField.Text)
> & "'"
>     AbbRecords.FindFirst AbbSearchString
>     If AbbRecords.NoMatch = False Then
>         Do Until AbbRecords.NoMatch = True
>             If AbbRecords!Verified = no Then
>                 Expansion.Text = "*" & AbbRecords!
> Definition & vbCr & _
>                     vbCr & Expansion.Text
>             Else
>                 Expansion.Text = AbbRecords!Definition &
> vbCr & vbCr & _
>                     Expansion.Text
>             End If
>             AbbRecords.FindNext AbbSearchString
>         Loop
>     Else
>         Expansion.Text = "Not Found"
>     End If
> End If

> 'Close out of database
> AbbRecords.Close
> AbbreviationDB.Close

> End Sub



Sun, 12 Sep 2004 04:56:09 GMT  
 DAO 3.5 object library vs. DAO 3.51
I'm afraid this didn't make any difference.  I did make
another discovery, however.  Another co-worker only had
reference library DAO 3.51, but my macro worked on her
computer.  So I started looking for other differences, and
found that the computer that didn't work (Barb's computer)
was using Microsoft Access SR-1, and the rest of us had SR-
2.  IT upgraded her Access to SR-2, and we get a different
error:

ActiveX component can't create object.

It's complaining about the same line of code:
Set DBWork=DBEngine.CreateWorkspace("","Admin","",
dbUseJet)
Also, when I try to open the Access database on Barb's
computer, she gets this error message:

You don't have a source code control program (such as
Microsoft Visual SourceSafe) installed on your machine.  
The source code control commands are therefore not
available.

She still gets that error message, even with SR-2.  I
don't know if it's relevant or not, though.

Any suggestions on where I should look next?

Quote:
>-----Original Message-----
>Try changing the declarations so that all the DAO objects
are declared
>explicitly:

>Dim AbbreviationDB As DAO.Database
>Dim DBWork As DAO.Workspace
>Dim AbbRecords As DAO.Recordset

>The problem might be, not that the machine is using 3.51
instead of 3.5 (the
>differences are minor) but a conflict with other

definitions of these object
Quote:
>names.


message

>> I have a program that works in Word and finds things in
an
>> Access database.  It works fine on my computer, but on
my
>> co-worker's computer, she gets an error message:

>> Wrong number of arguments or invalid property
assignment.

>> If I click on Debug, it highlights this line of code:

>> Set DBWork=DBEngine.CreateWorkspace("", "Admin", "",
>> dbUseJet)

>> The only difference I can find is that I have Microsoft
>> DAO 3.5 object library selected in my reference
libraries,
>> and my co-worker doesn't have this listed.  She has DAO
>> 3.51, but that gives the above error.  (Incidentally, my
>> program works on another co-worker's computer and she
has
>> DAO 3.5, too).  I also tried the Microsoft DAO 2.5/3.5
>> Compatibility Library and it didn't work.  So I
contacted
>> our IT department to see if they could install the right
>> library for my co-worker, but they can't figure out how
to
>> do it.  Can I change my program so that it works for
both
>> 3.5 and 3.51?  This is the whole subroutine:

>> 'Look up the abbreviation in the database and display
all
>> 'the expansions in the Expansion text box.  If the
>> 'expansion has not been verified, mark it with an
>> 'asterisk.
>> Private Sub CheckDB_Click()
>> 'Local variables
>> Dim AbbreviationDB As DAO.Database
>> Dim DBWork As Workspace
>> Dim AbbRecords As Recordset
>> Dim AbbSearchString As String, User As String

>> 'Constants
>> Const dbPath As String = "H:\Writers Folders\z Common
>> Text\Abbreviations.mdb"

>> 'Initializing variables
>> User = DBEngine.Workspaces(0).UserName
>> Set DBWork = DBEngine.CreateWorkspace("AbbrevWorkspace",
>> User, "", dbUseJet)
>> Set AbbreviationDB = OpenDatabase(dbPath, True)
>> Set AbbRecords = AbbreviationDB.OpenRecordset
>> ("Abbreviations", _
>>     dbOpenSnapshot)

>> 'Check that there is an abbreviation in the field
>> If AbbrField.Text = "" Then
>>     MsgBox "You must type an abbreviation in the
>> Abbreviation field."
>> Else
>>     'Retrieve definitions for the current abbreviation
>>     AbbSearchString = "Abbrev = '" & Trim
(AbbrField.Text)
>> & "'"
>>     AbbRecords.FindFirst AbbSearchString
>>     If AbbRecords.NoMatch = False Then
>>         Do Until AbbRecords.NoMatch = True
>>             If AbbRecords!Verified = no Then
>>                 Expansion.Text = "*" & AbbRecords!
>> Definition & vbCr & _
>>                     vbCr & Expansion.Text
>>             Else
>>                 Expansion.Text = AbbRecords!Definition &
>> vbCr & vbCr & _
>>                     Expansion.Text
>>             End If
>>             AbbRecords.FindNext AbbSearchString
>>         Loop
>>     Else
>>         Expansion.Text = "Not Found"
>>     End If
>> End If

>> 'Close out of database
>> AbbRecords.Close
>> AbbreviationDB.Close

>> End Sub

>.



Sun, 19 Sep 2004 06:06:19 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. DAO 3.5 vs DAO 3.51

2. Reference DAO 3.6 Object Library or DAO 2.5/3.51 Compatibility Library

3. DAO 3.5 & DAO 3.51 work differently

4. DAO 3.5 vs 3.51 PLEASE HELP !!!

5. DAO 3.6 vs DAO 3.5 (VB6.0 sp3)

6. DAO 3.0 vs DAo 3.5

7. DAO 3.5 / 3.51 problem

8. DAO 3.5 Object Library problems

9. Missing 3.5 DAO Object Library Please HELP

10. Missing DAO 3.5 Object Library

11. Microsoft DAO 3.51 Object Library missing using CreateDatabase

12. Moving from DAO 3.5 to DAO 3.6

 

 
Powered by phpBB® Forum Software