Solved

OpenDatabase Error (-7748) with Sybase

Posted on 2003-12-03
5
705 Views
Last Modified: 2013-12-25
Hi experts heres a tricky one!

I'm trying to connect to a Sybase Databse and an Access database, the idea is to pass information from access to Sybase. I'm using DAO Database and Recordsets in both cases, but when trying to run a select statement to gather the information I need to validate I get the -7748 reserved error with the legend "There is no message for this Error".

I'm defining my variables inside a module like this:

Global wrkJet As Workspace
Global MyDB As Database
Global MyDBSyb As Database
Global rs As DAO.Recordset
Global rs2 As DAO.Recordset
Global rssyb As DAO.Recordset


And the code in my form goes like this:

Private Sub Form_Load()
    Set wrkJet = CreateWorkspace("", "admin", "")
    Set MyDB = wrkJet.OpenDatabase("codigos.mdb")
    Set MyDBSyb = wrkJet.OpenDatabase("Telephony", _
    dbDriverNoPrompt, False, _
    "ODBC;DATABASE=telephony;UID=uid;PWD=pwd;DSN=telephony")
End Sub

Private Sub Command2_Click()
    strsql = "SELECT usuario.idext, usuario.usu_noext, usuario.usu_nom, usuario.usu_pwd," _
    & " usuario.usu_cod1, usuario.usu_cod2" _
    & " FROM usuario ORDER BY usuario.usu_noext"
    Set rssyb = MyDBSyb.OpenRecordset(strsql)


   more code here .....


I have used some similar code for connecting to sybase with no problem, actualy I already check the database and do some querys using other tools (Microsoft Query) to check if there was a problem with the Db or ODBC, but sadly with no luck.

Thanks in advance!!

0
Comment
Question by:ecantu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 29

Accepted Solution

by:
leonstryker earned 500 total points
ID: 9871103
I would go with ADO


Public MyDB As ADODB.Connection
Public MyDBSyb As ADODB.Connection
Public rs As ADODB.Recordset
Public rs2 As ADODB.Recordset
Public rssyb As ADODB.Recordset


And the code in my form goes like this:

Private Sub Form_Load()

    Set MyDB = New ADODB.Connection
    Set MyDBSyb = New ADODB.Connection

    MyDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=c:\somepath\myDb.mdb;" & _
           "User Id=admin;" & _
           "Password="

    MyDBSyb.Open "Provider=Sybase.ASEOLEDBProvider;" & _
           "Srvr=myASEServer,5000;" & _
           "Catalog=myDBName;" & _
           "User Id=myUserName;" & _
           "Password=myUserPassword"

End Sub

Private Sub Command2_Click()
    strsql = "SELECT usuario.idext, usuario.usu_noext, usuario.usu_nom, usuario.usu_pwd," _
    & " usuario.usu_cod1, usuario.usu_cod2" _
    & " FROM usuario ORDER BY usuario.usu_noext"
 
    Set rssyb = New ADODB.Recordset
    rssyb.Open strsql, MyDBSyb, adOpenStatic, adLockOptemistic

Leon
0
 
LVL 27

Expert Comment

by:Dabas
ID: 9873796
Hi ecantu:
Which line does the error occur on?

Dabas
0
 

Author Comment

by:ecantu
ID: 9875128
The last line in the Command2_Click() event:

Set rssyb = MyDBSyb.OpenRecordset(strsql)
0
 

Author Comment

by:ecantu
ID: 9875679
I change the code to ADO where I used the Sybase Db and keep using DAO for Access and worked fine (for my puorpuose anyway :p)


Thanks leonstryker!
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9875704
You are right to keep it that way.  DAO works great with Access, but it was never meant to be used with anything else.

Thanks for the grade,

Leon
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month8 days, 9 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question