Solved

OpenDatabase Error (-7748) with Sybase

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 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…

920 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

15 Experts available now in Live!

Get 1:1 Help Now