Solved

OpenDatabase Error (-7748) with Sybase

Posted on 2003-12-03
5
695 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now