Art - You should be able to parse the provider from the first element of the string. It shouold be the first element as in this example:
---In MS_Access_Professionals@yahoogroups.com, <dbalorenzini@yahoo.com> wrote :
With Warm Regards,
I was wondering how you were going to do that.
You'll have to share your completed code if you choose.
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Friday, August 11, 2017 2:29 PM
To: Liz Ravenwood liz_ravenwood@beaerospace.com [MS_Access_Professionals]
Subject: Re: RE: RE: RE: [MS_AccessPros] Re: Passing a string from an API
I am also thinking I need to flag what type of Connection String it is... Access, SSQL Server, Oracle, whatever....
With Warm Regards,
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265 Ext. 130
Fax (605)964-1070
"Valar Dohaeris"
On Friday, August 11, 2017 04:14:09 PM, Liz Ravenwood liz_ravenwood@beaerospace.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
AH. Sounds like cool code and a challenging thing.
https://www.connectionstrings.com/
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Friday, August 11, 2017 1:39 PM
To: Liz Ravenwood liz_ravenwood@beaerospace.com [MS_Access_Professionals]
Subject: Re: RE: RE: [MS_AccessPros] Re: Passing a string from an API
Yes the user can test the connection in the DAtaLink dialog but I wanted to provide the test so they did need to use the DataLink every time.
Now the question is what does this look like?
connect code here to connect
Because this could ODBC, SQL Server, Access, Oracle, etc... Is there a site where I could look this up?
With Warm Regards,
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265 Ext. 130
Fax (605)964-1070
"Valar Dohaeris"
On Friday, August 11, 2017 03:33:10 PM, Liz Ravenwood liz_ravenwood@beaerospace.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Arthur, is the user going to test the connection string outside of the Access app?
Private sub cmdTestConnection_Onclick()
….
If isvalid(me.txtconn) then
'valid
Else
Msgbox("invalid conn string")
End if
End sub
Private function isvalid(strConn as string) as Boolean
On error goto err_out
' connect code here to connect
Isvalid = true
Goto exit_out
Err_out:
Isvalid = false
End function
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Friday, August 11, 2017 11:59 AM
To: Liz Ravenwood liz_ravenwood@beaerospace.com [MS_Access_Professionals]
Subject: Re: RE: [MS_AccessPros] Re: Passing a string from an API
That worked the Me.txtConn = cn.connectionstring
But now I have the connection string. Can I create a command button on my form cmdTestConnection which I pass in and allow the user to test to make sure the connection is valid?
With Warm Regards,
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265 Ext. 130
Fax (605)964-1070
"Valar Dohaeris"
On Friday, August 11, 2017 12:30:56 PM, Liz Ravenwood liz_ravenwood@beaerospace.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Is there any way you can set the form text box to the connection string like
Me.txtConn = cn.connectionstring
?
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Friday, August 11, 2017 10:29 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: Passing a string from an API
Hi Art
I've never used that reference before, but check to see if it has a "Connect" or ConnectString property. If you open the connection and then open a watchwindow on the connection. You will be able to drill down to see all the properties.
But if what you want is the connection itself, you can't close it once it is open. And you will have to pass the connection as a reference. I've passed connections like this. A lot of the code is useless to you because I have other internal routines in play, but you can see how I pass the connection as an ADODB.Connection
'Routine:
Public Function RunProcImpTbl(strSP As String, cnn As ADODB.Connection) As Boolean
'Purpose : Run Import Job to fill import table(s).
!
'DateTime : 9/13/2005 15:01
'Author : Bill Mosca
'Jobs :
' File_Import_AcctDat (includes AcctDat and AcctDesc)
' File_Import_CC_CCGrps
' File_Import_IPDescr_ProdVol
' File_Import_JobCodes
' File_Import_LMFiles
' File_Import_Opns
' File_Import_PC1
Dim strStoredProc As String
Dim cmd As ! ADODB.Command
! Dim strJob As String
If gbolErrorTrapOff = False Then On Error GoTo err_RunProcImpTbl
strStoredProc = "dbo.File_Import_" & strSP
SysCmd acSysCmdSetStatus, "Running " & strStoredProc
Set cmd = New ADODB.Command
cmd.ActiveConnection = cnn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = strStoredProc
cmd.Execute
'Check job status.
strJob = "FRS_Import_" & strSP
RunProcImpTbl = GetJobStatus(strJob, cnn)
exit_RunProcImpTbl:
On Error Resume Next
SysCmd acSysCmdClearStatus
Set cmd = Nothing
Exit Function
err_RunProcImpTbl:
Select Case Err.Number
Case Else
gProcName = "RunProcImpTbl"
glngErrNum = Err.Number
gstrErrDescr = Err.Description
glngLineNum = Erl
Call ErrorLog("basImportProcess")
End Select
Resume exit_RunProcImpTbl
End Function
Regards,
Bill Mosca, Founder - MS_Access_Professionals
My nothing-to-do-with-Access blog
---In MS_Access_Professionals@yahoogroups.com, <dbalorenzini@yahoo.com> wrote :
I have the following code that opens Windows Datalink Dialog so you an set connection strings.
Private Sub cmdOpenDataLink_Click()
Dim cn As ADODB.Connection
Dim MSDASCObj As MSDASC.DataLinks
Set MSDASCObj = New MSDASC.DataLinks
Set c! n = New ADODB.Connection
MSDASCObj.PromptEdit cn
! cn.Open
MsgBox "Connection opened successfully"
cn.Close
End Sub
Is it possible after the user creates the connection to pass it from the DataLink dialog back to my form?
Thanks,
Art Lorenzini
Sioux Falls, SD
This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
Posted by: wrmosca@comcast.net
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (11) |
Tidak ada komentar:
Posting Komentar