UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Connect to an ODBC data source with Prompt    
 
   
Candace Tripp
post Jun 27 2002, 08:00 AM
Post#1


UA Admin & Utter Angel
Posts: 3,039
Joined: 30-January 00
From: Virginia, USA


Description
Creates a connection by prompting the user with the standard ODBC connection dialog
xample
Sub PreConnectPrompt ()
' ==============================================
' Example code for PreConnectWithPrompt()
' ----------------------------------------------
' Prompts the user for ODBC login information
' and establishes a connection to an ODBC
' server.
' ==============================================
Dim bOK As Boolean

bOK = PreConnectWithPrompt()
End Sub
Function PreConnectWithPrompt() As Integer
' Comments : Creates a connection by prompting the user with the standard ODBC connection dialog
' Parameters: none
' Returns : True if successful, False otherwise
'
Dim db As Database

On Error GoTo err_PreConnectWithPrompt
' Create the connection
Set db = DBEngine.Workspaces(0).OpenDatabase("", False, False, "ODBC;")
' Close the database, but the connection remains open
db.Close
PreConnectWithPrompt = True
exit_PreConnectWithPrompt:
Exit Function
err_PreConnectWithPrompt:
PreConnectWithPrompt = False
Resume exit_PreConnectWithPrompt
End Function
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    15th December 2017 - 02:40 PM