Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass-through query in MS access

Status
Not open for further replies.

bryger

Programmer
Apr 16, 2022
2
0
0
PE
Hello, I need to use this function but not with an odbc string, I want to use another string example:
= "PROVIDER=SQLOLEDB " & _
" ;PASSWORD=123456" & _
" ;PERSIST SECURITY INFO=TRUE " & _
" ;USER ID=sa " & _
" ;INITIAL CATALOG=DEMO " & _
" ;DATA SOURCE=SERVIDORDATADEMO\GODADDYSQL"


This function mentioned below works perfectly but it tells me that ODBC should not be used, could you help me?

Function CreateSPT(SPTQueryName As String, strSQL As String)

Dim cat As ADOX.Catalog
Dim cmd As ADODB.Command

Set cat = New ADOX.Catalog
Set cmd = New ADODB.Command

cat.ActiveConnection = CurrentProject.Connection

Set cmd.ActiveConnection = cat.ActiveConnection

cmd.CommandText = strSQL
cmd.Properties("Jet OLEDB:ODBC Pass-Through Statement") = True

'Modify the following connection string to reference an existing DSN for
'the sample SQL Server PUBS database.

cmd.Properties _
("Jet OLEDB:pass Through Query Connect String") = _
"ODBC;DSN=myDSN;database=pubs;UID=sa;PWD=;"
cat.Procedures.Append SPTQueryName, cmd

Set cat = Nothing
Set cmd = Nothing

End Function


thank you very much for what you can help me

 
Hello Bryger,

I'm not sure if people who might be able to assist speak Spanish. It would really help if you could describe your requirements etc in English. Sorry...

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 

Thank you I already translated it thank you very much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top