[AccessD] Access Data Project (ADP) and Access Runtime

Anita Smith anitatiedemann at gmail.com
Thu Oct 18 01:30:23 CDT 2007


Darren,
Call this function when your adp opens (it will set the connection for you
without using the dialog) - it will only attempt to set the connection if is
is not already set, which is why I clear the connection before I give the
users a new adp:

Public Function RunConnection() As Boolean
   Dim sUID As String
   Dim sPWD As String
   Dim sServerName As String
   Dim sDatabaseName As String

        If IsConnectionSet = True Then
            RunConnection = True
            Exit Function
        End If

        sUID = "UserID"
        sPWD = "Password"
        sServerName = "ServerName"
        sDatabaseName = "DBName"
        '
        ' Clear the current connection
        '
        MakeADPConnectionless

        ' Make a new connection and connect this adp to new database.
            '
          sConnectionString = "PROVIDER=SQLOLEDB.1;PASSWORD=" & sPWD & _
         ";PERSIST SECURITY INFO=TRUE;USER ID=" & sUID & _
         ";INITIAL CATALOG=" & sDatabaseName & _
         ";DATA SOURCE=" & sServerName

        Application.CurrentProject.OpenConnection sConnectionString

        RunConnection = True
        IsConnectionSet = True

End Function



On 10/18/07, Darren D <darren at activebilling.com.au> wrote:
>
> Hi Anita et al
>
> Thanks for the response
>
> Excellent - it got me one step closer
>
> Now I am unable to get the SQL Server properties dialogue box to come up
>
> You know the one  -
> http://www.blueclaw-db.com/website_database_connections/udl.gif
>
> Even when I Include a tool bar with the "File | Connection" item from the
> FILE
> tool bar
>
> I can see the tool bar I added - but when I click It nothing happens - no
> dialogue at all
>
> I have even set up a Macro (RunCommand | ConnectDatabase) still won't work
>
> I even set it up to work via code - Still no joy
>
> Any reason why that dialogue will appear in full blown access but not in
> the
> runtime?
>
> It all hangs on this little bit - If I can get that Dialogue to appear - I
> think
> it will be deliverable
>
> Darren
> -----------------
> T: 1300 301 731
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Anita Smith
> Sent: Thursday, 18 October 2007 1:50 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Access Data Project (ADP) and Access Runtime
>
> Darren,
> I normally run a function before I ship my database to make sure that the
> adp has no connection string. I run this from the debug window:
> MakeADPConnectionless
> IsConnectionSet = False
>
> You should then be able to set the connection on open of the adp.
>
> This is the function I use to remove the current connection:
>
> Public Function MakeADPConnectionless() As Boolean
>        ' Close the connection.
>        Application.CurrentProject.CloseConnection
>
>        ' Set the connection to nothing.
>        Application.CurrentProject.OpenConnection
>
>        ' Set the flag...
>        MakeADPConnectionless = True
> End Function
>
> The Shift Key won't work in runtime mode.
>
> Anita
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list