Results 1 to 2 of 2
  1. #1
    Remphan is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2016
    Posts
    7

    Change ADODB.Recordset by New

    Help pls change ADODB.Recordset and adodb.connection with New.ADODB.Recordset and New.adodb.connection
    in that code:

    Code:
    Option Explicit
    
    Function DataSql(dt_sql)
    DataSql = "#" & Format(dt_sql, "mm\/dd\/yy hh\:mm\:ss") & "#"
    End Function
    
    Function GetAccessConnect(FilePath As String)
    Dim sCon As String, strMyDBPassword As String
    Set GetAccessConnect = CreateObject("adodb.connection")
    strMyDBPassword = "642531"
    With GetAccessConnect
        .CursorLocation = 3
        sCon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="
        sCon = sCon & FilePath & ";Jet OLEDB:Database Password=" & strMyDBPassword & ";"
    
    
        .Open sCon
    End With
    End Function
    
    Sub test55()
    Set Cn = GetAccessConnect(ThisWorkbook.Path & "\data.accdb")
    Set Rs = CreateObject("ADODB.Recordset")
    End Sub
    
    Function GetRs(Cn, sstr)
    Set GetRs = CreateObject("ADODB.Recordset")
    GetRs.Open sstr, Cn, 3, 3
    End Function


  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    What are you attempting to do with this code? Are you trying to retrieve information from a different database without having the table in question linked into the database where this code is running?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error Handling with ADODB Recordset Object
    By Aaron5714 in forum Programming
    Replies: 3
    Last Post: 12-27-2012, 04:02 PM
  2. Difficulty returning ADODB recordset from function
    By randman1 in forum Programming
    Replies: 4
    Last Post: 07-19-2012, 01:07 PM
  3. form/subform ADODB recordset
    By rashima in forum Forms
    Replies: 1
    Last Post: 04-27-2012, 12:19 PM
  4. Replies: 2
    Last Post: 03-08-2012, 12:59 PM
  5. ADODB Recordset behaving strangely
    By RayMilhon in forum Programming
    Replies: 4
    Last Post: 11-04-2011, 12:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums