Connect to Access in Com HELP!

Results 1 to 2 of 2

Thread: Connect to Access in Com HELP!

  1. #1
    Join Date
    Dec 1969

    Default Connect to Access in Com HELP!

    Okay, small problem, and any help would be greatly appriciated.<BR>I&#039m working on a COM object that is supposed to open up an access database, go through 5000 or so records (client won&#039t let us use Oracle), pull out a set of record in a SQL code, and bring up around 20 different statistics on these records. I figured it&#039s better that I do this in a COM object then ASP. Does anybody have any code that will help me open this Access database in the COM object? Thanks for any help!

  2. #2
    hip Guest

    Default RE: Connect to Access in Com HELP!

    hope this help i use this for class to connection to a access db<BR><BR><BR>Public adocn As ADODB.Connection &#039connection object to the database<BR><BR>Function OpenADOConnection(strdbms As String) As Boolean<BR> <BR> Dim strconnect As String<BR> Dim strErrorMsg As String<BR> <BR> On Error GoTo Error_Routine<BR><BR> &#039This is a connection to An Access DBMS<BR>strconnect = "DRIVER={Microsoft Access Driver (*.mdb)};" _<BR> & "UID=Admin;PWD=;" _<BR> & "DBQ=" + strdbms + ";"<BR> <BR> Set adocn = New ADODB.Connection &#039Initializes the instance<BR> With adocn &#039With the object<BR> .CommandTimeout = 45 &#039Command timeout<BR> .ConnectionTimeout = 25 &#039Connection timeout<BR> .CursorLocation = adUseClient &#039Cursor resides on the client<BR> .Mode = adModeReadWrite &#039Read/Write functionality<BR> .ConnectionString = strconnect &#039Sets the connection string in the object<BR> .Open &#039Method to open the connection<BR> End With<BR> OpenADOConnection = True &#039If the ADO Object is succesful, connection<BR> Exit Function &#039opens<BR> <BR>Error_Routine:<BR> strErrorMsg = "Error Opening ADO Connection " _<BR> & "Error Number: " & Err.Number & vbCrLf _<BR> & "Description : " & Err.Description<BR> Call MsgBox(strErrorMsg, vbCritical, "ADO Connection Error")<BR> OpenADOConnection = False<BR>End Function<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts