CreateWorkspace problem

CreateWorkspace problem

Post by adamek12 » Tue, 06 Jun 2000 04:00:00



Hello,
I have this problem trying to pass UID and PWD to CreateWorkspace method.
My application is using ADO throughout. However I need to enumerate reports
defined in Access and run them from VB application. I capture Username and
Password when user first logs on in the application.
In the code below I am trying to pass those strings to DBEngine without
sucess. User still gets Log-on dialog from ACCESS.
I am using VB 6.0 SP3, Access 97.

Private Sub FillReportsList()
    On Error GoTo ErH
    lvReports.ListItems.Clear
    Dim lItem As MSComctlLib.ListItem
    Dim o As Object

    'Each one of the following statements prompts the user for UID and PWD
    'DBEngine does not accept it as a string. I also tried
    'Set o = New Access.Application and
    'Set o = DBEngine.CreateWorkspace(Name:="TMP", UserName:=gstrUserName,
Password:=gstrPassword, UseType:=2)
    '???????????
    Set o = DBEngine.CreateWorkspace("TMP", gstrUserName, gstrPassword, 2)
    Set o = DBEngine.OpenDatabase(DEF_DIR & DEF_DB, False, False, "ms
access;UID=" & gstrUserName & ";pwd=" & gstrPassword & ";")
    '???????????
    Dim sRepName As String
    Dim x As Integer
    For x = 0 To o.Containers("Reports").Documents.Count - 1
        sRepName = o.Containers("Reports").Documents(x).Name
        Set lItem = lvReports.ListItems.Add(x + 1, sRepName, sRepName, 1, 1)
        '...

    Next
    Exit Sub
ErH:
    MsgBox Err.Description
End Sub

 
 
 

CreateWorkspace problem

Post by Phil N » Wed, 07 Jun 2000 04:00:00


Hi adamek123

CreateWorkspace only deal with numbers. Therefore try the following:

    set o = DBEngine.CreateWorkspace(0,...)
        or if the above is not working then try using
    set o = DBEngine.CreateWorkspace(0)

I hope this helps

Sincerely

Phil N.


Quote:> Hello,
> I have this problem trying to pass UID and PWD to CreateWorkspace method.
> My application is using ADO throughout. However I need to enumerate
reports
> defined in Access and run them from VB application. I capture Username and
> Password when user first logs on in the application.
> In the code below I am trying to pass those strings to DBEngine without
> sucess. User still gets Log-on dialog from ACCESS.
> I am using VB 6.0 SP3, Access 97.

> Private Sub FillReportsList()
>     On Error GoTo ErH
>     lvReports.ListItems.Clear
>     Dim lItem As MSComctlLib.ListItem
>     Dim o As Object

>     'Each one of the following statements prompts the user for UID and PWD
>     'DBEngine does not accept it as a string. I also tried
>     'Set o = New Access.Application and
>     'Set o = DBEngine.CreateWorkspace(Name:="TMP", UserName:=gstrUserName,
> Password:=gstrPassword, UseType:=2)
>     '???????????
>     Set o = DBEngine.CreateWorkspace("TMP", gstrUserName, gstrPassword, 2)
>     Set o = DBEngine.OpenDatabase(DEF_DIR & DEF_DB, False, False, "ms
> access;UID=" & gstrUserName & ";pwd=" & gstrPassword & ";")
>     '???????????
>     Dim sRepName As String
>     Dim x As Integer
>     For x = 0 To o.Containers("Reports").Documents.Count - 1
>         sRepName = o.Containers("Reports").Documents(x).Name
>         Set lItem = lvReports.ListItems.Add(x + 1, sRepName, sRepName, 1,
1)
>         '...

>     Next
>     Exit Sub
> ErH:
>     MsgBox Err.Description
> End Sub


 
 
 

CreateWorkspace problem

Post by adamek12 » Wed, 07 Jun 2000 04:00:00


I haven't had time to try it yet, but it sounds reasonable. Thanx.


> Hi adamek123

> CreateWorkspace only deal with numbers. Therefore try the following:

>     set o = DBEngine.CreateWorkspace(0,...)
>         or if the above is not working then try using
>     set o = DBEngine.CreateWorkspace(0)

> I hope this helps

> Sincerely

> Phil N.



> > Hello,
> > I have this problem trying to pass UID and PWD to CreateWorkspace
method.
> > My application is using ADO throughout. However I need to enumerate
> reports
> > defined in Access and run them from VB application. I capture Username
and
> > Password when user first logs on in the application.
> > In the code below I am trying to pass those strings to DBEngine without
> > sucess. User still gets Log-on dialog from ACCESS.
> > I am using VB 6.0 SP3, Access 97.

> > Private Sub FillReportsList()
> >     On Error GoTo ErH
> >     lvReports.ListItems.Clear
> >     Dim lItem As MSComctlLib.ListItem
> >     Dim o As Object

> >     'Each one of the following statements prompts the user for UID and
PWD
> >     'DBEngine does not accept it as a string. I also tried
> >     'Set o = New Access.Application and
> >     'Set o = DBEngine.CreateWorkspace(Name:="TMP",

UserName:=gstrUserName,

- Show quoted text -

Quote:> > Password:=gstrPassword, UseType:=2)
> >     '???????????
> >     Set o = DBEngine.CreateWorkspace("TMP", gstrUserName, gstrPassword,
2)
> >     Set o = DBEngine.OpenDatabase(DEF_DIR & DEF_DB, False, False, "ms
> > access;UID=" & gstrUserName & ";pwd=" & gstrPassword & ";")
> >     '???????????
> >     Dim sRepName As String
> >     Dim x As Integer
> >     For x = 0 To o.Containers("Reports").Documents.Count - 1
> >         sRepName = o.Containers("Reports").Documents(x).Name
> >         Set lItem = lvReports.ListItems.Add(x + 1, sRepName, sRepName,
1,
> 1)
> >         '...

> >     Next
> >     Exit Sub
> > ErH:
> >     MsgBox Err.Description
> > End Sub

 
 
 

CreateWorkspace problem

Post by adamek12 » Wed, 07 Jun 2000 04:00:00


The problem seems to be related to DBEngine object. It does not accept
formal parameter (according to documented syntax speciffications).
maybe there is a solution using alternative technologies? J? C?


> Hi adamek123

> CreateWorkspace only deal with numbers. Therefore try the following:

>     set o = DBEngine.CreateWorkspace(0,...)
>         or if the above is not working then try using
>     set o = DBEngine.CreateWorkspace(0)

> I hope this helps

> Sincerely

> Phil N.



> > Hello,
> > I have this problem trying to pass UID and PWD to CreateWorkspace
method.
> > My application is using ADO throughout. However I need to enumerate
> reports
> > defined in Access and run them from VB application. I capture Username
and
> > Password when user first logs on in the application.
> > In the code below I am trying to pass those strings to DBEngine without
> > sucess. User still gets Log-on dialog from ACCESS.
> > I am using VB 6.0 SP3, Access 97.

> > Private Sub FillReportsList()
> >     On Error GoTo ErH
> >     lvReports.ListItems.Clear
> >     Dim lItem As MSComctlLib.ListItem
> >     Dim o As Object

> >     'Each one of the following statements prompts the user for UID and
PWD
> >     'DBEngine does not accept it as a string. I also tried
> >     'Set o = New Access.Application and
> >     'Set o = DBEngine.CreateWorkspace(Name:="TMP",

UserName:=gstrUserName,

- Show quoted text -

Quote:> > Password:=gstrPassword, UseType:=2)
> >     '???????????
> >     Set o = DBEngine.CreateWorkspace("TMP", gstrUserName, gstrPassword,
2)
> >     Set o = DBEngine.OpenDatabase(DEF_DIR & DEF_DB, False, False, "ms
> > access;UID=" & gstrUserName & ";pwd=" & gstrPassword & ";")
> >     '???????????
> >     Dim sRepName As String
> >     Dim x As Integer
> >     For x = 0 To o.Containers("Reports").Documents.Count - 1
> >         sRepName = o.Containers("Reports").Documents(x).Name
> >         Set lItem = lvReports.ListItems.Add(x + 1, sRepName, sRepName,
1,
> 1)
> >         '...

> >     Next
> >     Exit Sub
> > ErH:
> >     MsgBox Err.Description
> > End Sub

 
 
 

CreateWorkspace problem

Post by adamek12 » Wed, 07 Jun 2000 04:00:00


And again, the problem is with the Stupid Logon Dialog popping up and not
accepting data passed to DBEngine as parameter.
Appreciate any help and feels good to have a community.


> Hi adamek123

> CreateWorkspace only deal with numbers. Therefore try the following:

>     set o = DBEngine.CreateWorkspace(0,...)
>         or if the above is not working then try using
>     set o = DBEngine.CreateWorkspace(0)

> I hope this helps

> Sincerely

> Phil N.



> > Hello,
> > I have this problem trying to pass UID and PWD to CreateWorkspace
method.
> > My application is using ADO throughout. However I need to enumerate
> reports
> > defined in Access and run them from VB application. I capture Username
and
> > Password when user first logs on in the application.
> > In the code below I am trying to pass those strings to DBEngine without
> > sucess. User still gets Log-on dialog from ACCESS.
> > I am using VB 6.0 SP3, Access 97.

> > Private Sub FillReportsList()
> >     On Error GoTo ErH
> >     lvReports.ListItems.Clear
> >     Dim lItem As MSComctlLib.ListItem
> >     Dim o As Object

> >     'Each one of the following statements prompts the user for UID and
PWD
> >     'DBEngine does not accept it as a string. I also tried
> >     'Set o = New Access.Application and
> >     'Set o = DBEngine.CreateWorkspace(Name:="TMP",

UserName:=gstrUserName,

- Show quoted text -

Quote:> > Password:=gstrPassword, UseType:=2)
> >     '???????????
> >     Set o = DBEngine.CreateWorkspace("TMP", gstrUserName, gstrPassword,
2)
> >     Set o = DBEngine.OpenDatabase(DEF_DIR & DEF_DB, False, False, "ms
> > access;UID=" & gstrUserName & ";pwd=" & gstrPassword & ";")
> >     '???????????
> >     Dim sRepName As String
> >     Dim x As Integer
> >     For x = 0 To o.Containers("Reports").Documents.Count - 1
> >         sRepName = o.Containers("Reports").Documents(x).Name
> >         Set lItem = lvReports.ListItems.Add(x + 1, sRepName, sRepName,
1,
> 1)
> >         '...

> >     Next
> >     Exit Sub
> > ErH:
> >     MsgBox Err.Description
> > End Sub

 
 
 

1. Createworkspace problem in VB4-16bit - (Help)

If I have a valid Access user id & password (confirmed by running access)
why would I get a runtime error 3029  "Not a valid account name or
password"  while creating a workspace as in the following code.
=============================
' User and Pswd are set in earlier code (have also tried hardcoding)
' Note:  Set the inipath or will error with SYSTEM.MDA not available
DBEngine.IniPath = "C:\Windows\MSACC20.ini"
Set wsStock = DBEngine.CreateWorkspace("", User, Pswd)

Comment out the createworkspace and the following non-secured code does
work
===============================
Set dbStock = DBEngine.Workspaces(0).OpenDatabase(App.Path & "\stock.mdb")
======

I'm Using Win95 OS,  VB4-16bit with Access 2.0  (enduser is in win3.1)

2. Tool (Windows) to periodically replicate databases

3. Createworkspace problem in VB4 (Help)

4. Checking for duplicate records in an ADO recordset

5. Jet CreateWorkspace problems in VB 4

6. dbexport problem

7. CreateWorkspace - security problem in VB4

8. Creating PRIMARY FileGroup and PRIMARY File

9. Problems with CreateWorkspace() method

10. CreateWorkSpace error

11. HELP! - Error 3633 during VBA CreateWorkspace

12. CreateWorkspace Question

13. Help....Error 3028: CreateWorkspace error.