Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8

    Unanswered: Read Forms from another Database

    I have

    Set db1 = DBEngine.OpenDatabase("Updates.accdb")

    For Each qy In db1.QueryDefs
    rs.AddNew
    rs("thisName") = qy.Name
    rs("ADate") = qy.LastUpdated
    rs.update
    Next

    now I want to read the Forms that are in db1

    which manual do i read
    Last edited by Missinglinq; 08-17-14 at 22:14. Reason: Correct spelling/clarify meaning
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    Just use a macro,
    event: TransferDatabase
    to copy all forms into your target db.

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Quote Originally Posted by myle View Post
    now I want to read the Forms that are in db1
    What do you mean by "read the Forms" ? Do you want to retrieve the names of the forms in the external Access database ?
    Code:
    Function GetFormNames(ByVal DatabasePath As String) As Variant
    '
    ' Returns an array containing the names of all forms existing in
    ' the external Access database specified by the argument DatabasePath.
    '
    ' Returns an initialized array (0 to -1) if there is no forms in DatabasePath.
    '
    ' Displays an info message and an empty Variant if DatabasePath does not exists.
    '
        Const c_SQL As String = "SELECT name FROM MSysObjects IN '@D' WHERE type = -32768;"
        
        Dim qdf As DAO.QueryDef
        Dim rst As DAO.Recordset
        Dim strSQL As String
        Dim strList As String
        
        If Len(Dir(DatabasePath)) > 0 Then
            strSQL = Replace(c_SQL, "@D", DatabasePath)
            Set qdf = CurrentDb.CreateQueryDef("", strSQL)
            With qdf
                Set rst = .OpenRecordset
                With rst
                    Do Until .EOF
                        If Len(strList) > 0 Then strList = strList & ";"
                        strList = strList & .Fields(0).Value
                        .MoveNext
                    Loop
                    .Close
                End With
                .Close
            End With
            Set rst = Nothing
            Set qdf = Nothing
            GetFormNames = Split(strList, ";")
        Else
            MsgBox "The database " & DatabasePath & " does not exist.", vbInformation, "File not found"
        End If
        
    End Function
    Or is it something else you're looking for?
    Have a nice day!

  4. #4
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    thanks that what i wanted
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •