Solved

OpenDatabase Error (-7748) with Sybase

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

791 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