AW: Access Bound Forms and ODBC-Driver

"Hübschen, Peter" <[email protected]>
Newsgroups gmane.comp.db.sapdb.general
Message-ID <5037282E0DC5D711974C00304852417A025E59@SERVER-XCH>
Hello, 

I had found a similar approach via google, but now I'm using the code below
in a login-Form. Now I can define a recordset and I have access to my tables
(at least a feeling of success :-)). You wrote that you use SQL-Statements
for Insert, Update, Delete. I'm doing this too at my Access-DB, but not for
all operations (I had to find a way between "Auto-Update" in Access and
manually changing the data).
So my questions are now:
- How do I realize that bound forms get the correct informations or have I
to set the content of every control manually?
- How can I execute a SQL-Statement directly (without a recordset)? I've
tried 'ODBCConnection.Execute("<Some SQL-Statement>")' with ODBCConnection
as my connection to SAP-DB, but I've got the following error: Compilation
error: Function or variable expected and .Execute is marked, if I open the
VBA-Editor.

These 3 question are just for my interest (so they are not so important):
- Is it possible to create a Access-DB without any tables, if I have a non
Access-Backend?
- If I don't have any tables directly in Access, how does Access handle it's
'Auto-Update' ( I mean the action between "Before-" and "After-Update")? Are
these actions called so that I can put my Update-Statements in those?

Thanks so far for your help

Peter

> -----Ursprüngliche Nachricht-----
> Von:	Yves Trudeau [SMTP:[email protected]]
> Gesendet am:	Mittwoch, 13. August 2003 16:49
> An:	Hübschen, Peter; Mailingliste SAPDB (E-Mail)
> Betreff:	RE: Access Bound Forms and ODBC-Driver
> 
> 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]]On 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
> 
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.