Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004

    Unanswered: Report recordsource question

    I have a report where I need to have the recordsource come from tables in an external mdb file.
    I've tried the following, but it's not working:

    Private Sub Report_Open(Cancel As Integer)
    ' Set Report Recordset propetry
    Dim db As DAO.Database
    Dim rstContractInfo As DAO.Recordset
    Set db = OpenDatabase(fDatabaseFile, , True)
    Set rstContractInfo = db.OpenRecordset("SELECT tblContractInfo.*, tblBudgetCodes.BudgetCode, " & _
    "tblBudgetCodes.BudgetCodeAmount, tblBudgetCodes.BudgetSource FROM tblContractInfo LEFT JOIN " & _
    "tblBudgetCodes ON tblContractInfo.ContractID=tblBudgetCodes.Contract ID")
    Me.RecordSource = rstContractInfo.Name
    Set rstContractInfo = Nothing
    Set db = Nothing
    End Sub

    I'm getting a message that tblContractInfo is not found.

  2. #2
    Join Date
    Jun 2004
    Florida, US
    I'm not sure if your code is correct. but one thing I'm sure you should link that table to your database before doing that.

  3. #3
    Join Date
    Sep 2004
    Or you can verify in the debugger window the tabledefs collection of db and search your table

Posting Permissions

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