Hi,
upon startup, you should execute something similar to the following insert.
db is a global variable of type database, ws and wsjet are global variable
of type Workspace and conn is a global variable of type connection. In your
code, use conn to make queries in SapDB SQL and db to make queries in Jet
SQL. In our application, we don't use DAO, we always use SQL Statement
(Insert, Update, Delete) to update the database.
Good luck,
Yves
'Beginning of the code
Dim Rs2 As Recordset
Dim GroupeId
Dim tdf As TableDef
DoCmd.Hourglass True
Set Ws = DBEngine.CreateWorkspace("", "", "", dbUseODBC)
Set wsjet = DBEngine.Workspaces(0)
Set db = CurrentDb
On Error Resume Next
strConnect = "ODBC;DSN=LOGILOC;UID=DBA;PWD=DBA;SERVERDB=LOGILOC;SERVERNODE="
& Serveur
'Creation of the odbc connection
Set Conn = Ws.OpenConnection("", dbDriverNoPrompt, , strConnect)
If Err.Number = 0 Then
On Error GoTo erreur
db.Connect = strConnect
debugPrint "db.connect", Now
'Setting of the tables connect property
For Each tdf In db.TableDefs
If Len(tdf.Connect) > 0 Then
If Left(tdf.Connect, Len(strConnect)) <> strConnect Then
debugPrint tdf.Name, tdf.Connect
tdf.Connect = strConnect
debugPrint tdf.Name, tdf.Connect
tdf.RefreshLink
End If
End If
Next
Dim qdf As QueryDef
'Setting of the query (ODBC Direct) connect property
For Each qdf In db.QueryDefs
If Len(qdf.Connect) > 0 Then
If Left(qdf.Connect, Len(strConnect)) <> strConnect Then
debugPrint qdf.Name, qdf.Connect
qdf.Connect = strConnect
debugPrint qdf.Name, qdf.Connect
End If
End If
Next
Else
MsgBox "Mauvais nom d'usager ou mot de passe (Sapdb)!", vbCritical,
"ATTENTION"
Exit Sub
End If
DoCmd.Hourglass False
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of H�bschen,
Peter
Sent: 13 ao�t, 2003 09:38
To: Mailingliste SAPDB (E-Mail)
Subject: Access Bound Forms and ODBC-Driver
Hello,
in Access 97 I have bound forms. I have linked my sapdb tables manually and
via VBA into Access. If I open such a bound form the dialog-box from the
ODBC-Driver opens and asks for a valid login. Sometimes I'm getting asked a
lot of times. And even if I type a valid login the form doesn't work like
under a pure Access-Environment.
How can I get rid of this dialog-box? Maybe then my forms will work again.
Thanks in advance
Peter Huebschen
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general