Re: getObject() and shell automation question

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Did you try making the change I suggested?

You may find it useful to read http://support.microsoft.com/?id=210111
(don't worry that it only mentions Access 2000: it applies to all versions)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"juneBug via AccessMonster.com" <forum@xxxxxxxxxxxxxxxxx> wrote in message
news:53A0EC63C2220@xxxxxxxxxxxxxxxxxxxx
> Doug.
>
> Thanks for replying...I am still locking horns with VBA over this...
> Here is the most recent attempt...
>
> Public Function openSecuredDBwAutomation()
> Dim accObj As Access.application, myDB As Database, myWS As
> Workspace,
> dbe As PrivDBEngine
> Dim strPathToMDWFile As String, strDefaultUser As String 'will be
> input param
> Dim strDefaultPwd As String, strPathToDatabase As String 'will be
> input param
>
> 'WILL BE INPUT PARAMS
>
> 'strPathToMDWFile = ""
> 'strDefaultUser = ""
> 'strDefaultPwd = ""
> 'strDefaultPwd = "ratesrus"
> 'strPathToDatabase = "C:\WINNT\Profiles\CTCUSER\Desktop\tester.mdb"
>
> 'OPEN WORKSPACE
> 'protected by MDW
> 'If strPathToMDWFile <> "" And strDefaultUser <> "" And strDefaultPwd
> <>
> "" Then
> ' Set myWS = CreateWorkspace("", strDefaultUser, strDefaultPwd,
> dbUseJet)
> ' ' Open the secured database.
> ' Set myDB = myWS.OpenDatabase(strPathToDatabase)
> 'Else
> 'password protection or unprotected db
> Set myWS = DBEngine.Workspaces(0)
> 'End If
>
> 'OPEN DATABASE
> 'MDW protected
> If strPathToMDWFile <> "" Then
> Set myDB = myWS.OpenDatabase _
> (strPathToDatabase, False, False, "MS Access;DATABASE=" &
> strPathToMDWFile & ";UID=" & strDefaultUser & ";PWD=" & strDefaultPwd)
> 'password protected
> ElseIf strDefaultPwd <> "" And strPathToMDWFile = "" Then
> Set myDB = myWS.OpenDatabase _
> (strPathToDatabase, False, False, "MS Access;PWD=" & strDefaultPwd)
> Else 'unprotected
> Set myDB = myWS.OpenDatabase(strPathToDatabase)
> End If
>
> 'GET ACCESS OBJECT
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> Set accObj = getObject(strPathToDatabase, "Access.Application")
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>
> 'GET RECORDSOURCE
> accObj.DoCmd.OpenForm "Form1", acDesign 'open form
> MsgBox accObj.Forms("Form1").RecordSource
>
> 'accObj.CloseCurrentDatabase
> 'accObj.Quit
>
> Set accObj = Nothing
> Exit Function
> End Function
>
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/200508/1


.



Relevant Pages

  • RE: Combo Box on User Form
    ... 'declare variables for new connection and recordset and declare variables ... Dim vConnection As New ADODB.Connection ... Dim vClientFName As String ... MsgBox "The connection to this database is working!", ...
    (microsoft.public.word.vba.general)
  • Re: running fRefreshLinks from another database
    ... lock the database I want to update links in. ... Dim i As Integer, strDBPath As String, strTbl As String ... Dim dbCurr As Database, dbLink As Database ...
    (microsoft.public.access.modulesdaovba)
  • Re: Virtual checkboxes
    ... And it creates a table in that database. ... Dim strQuery As String ... MakeNewTable dbs, strPrimaryKey, strNewTable ...
    (comp.databases.ms-access)
  • Virtual checkboxes
    ... It assumes that the default checkbox value is false but if you want to, you can set the initial value of the checkbox to True. ... It creates a database in the same folder you run the app from called CheckTable if it doesn't exist. ... Dim strQuery As String ...
    (comp.databases.ms-access)
  • Re: Combo Box on User Form
    ... 'declare variables for new connection and recordset and declare variables ... Dim vConnection As New ADODB.Connection ... Dim vClientFName As String ... MsgBox "The connection to this database is working!", ...
    (microsoft.public.word.vba.general)