Apologies to Dr. Thomas K�tter, I pressed reply instead of Reply to list
so he has the first part of this mail already.  Sorry.

When you link the table, did you select the "save password" checkbox?  I
know it's an stupid question, but sometimes it's the easy answers that
get missed.

I've just finished the same exercise, I have some Access VBA that links
the tables (I use it to switch between dev, test and prod), I'l look it
out and post it.


Access routine to link to SAP DB table.  Note that I have a local table
called ltblConnectionMaster.  This contains the ODBC connection details,
like user id, password, server and DSN.  You don't *need* this, it just
gives flexibilty

Public Sub make_ODBC(strSystem As String)
 
    Dim dbs As Database
    Dim tdf As TableDef
    Dim cTableIx As Integer
    Dim strServerConn As String
 
    Set dbs = CurrentDb()

    strServerConn = get_conn_string(strSystem)

    DoCmd.Hourglass True
    ' Loop through all tables in the database.
    For Each tdf In dbs.TableDefs
        ' Let's take only the visible tables
        If (((tdf.Attributes And DB_SYSTEMOBJECT) Or _
        (tdf.Attributes And DB_HIDDENOBJECT))) = 0 Then
            ' If the table has a connect string, it's a linked table.
            If Len(tdf.Connect) > 0 Then
                tdf.Connect = strServerConn
                tdf.RefreshLink
            End If
        End If
    Next tdf
    dbs.Close
    DoCmd.Hourglass False
 
End Sub

Private Function get_conn_string(Optional ByVal strSystem As String) As
String
     
    Dim dbs As Database
    Dim rst As Recordset
    Dim strServerConn As String
 
    Set dbs = CurrentDb()
    Set rst = dbs.OpenRecordset("ltblConnectionMaster", dbOpenSnapshot)
    If Len(strSystem) = 0 Then
        rst.FindFirst "ActiveConnection=true"
    Else
        rst.FindFirst "sysid='" & strSystem & "'"
    End If
    If rst.NoMatch Then
        get_conn_string = ""
    Else
        get_conn_string = "ODBC;DSN=" & rst!dsn _
                        & ";DATABASE=" & rst!dbname _
                        & ";SERVER=" & rst!Server _
                        & ";PWD=" & rst!Password _
                        & ";UID=" & UCase(rst!uid) & ";"
    End If
                                                                                End 
Function


Regards

Alan Graham



On Wed, 2003-08-13 at 21:43, Koetter, Thomas Theodor wrote:
> Hi Peter,
> 
> > -----Original Message-----
> > From: "H�bschen, Peter" [mailto:[EMAIL PROTECTED]
> > Sent: Mittwoch, 13. August 2003 15: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.
> 
> I guess, the popup dialog is the one initiated by SQLDriverConnect.
> 
> 
> > 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. 
> 
> SQLDriverConnect can be called with the attribute NO_PROMPT.
> Then no popup is shown and a logon is performed if all
> necessary data is provided.
> 
> > How can I get rid of this dialog-box? Maybe then my forms 
> > will work again.
> 
> In VB the NO_PROMPT attribute is surely available, too.
> 
> 
> 
> HTH  Thomas
> 
> 
> ----------------------------------------------
> Dr. Thomas K�tter
> SAP DB, SAP Labs Berlin
> 
> 
> Hurry up, SAP DB is open source     www.sapdb.org
> 
> 
> 
> _______________________________________________
> 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

Reply via email to