Search code examples
ms-access-2016

DoCmd.OpenForm Not Working with Multiple Databases in one File


I am at a loss here.... I am fairly new to Access, but I have already done the DoCmd.OpenForm in 2 other databases and it worked just fine once I found the right code to use.

So this is what I've done. I originally had 3 separate databases (separate Access files) before realizing you could create multiple databases within one Access file. They are garden related: Seed Catalog, Flower Seed Starting Journal, and Vegetable Seed Starting Journal. With the Seed Catalog opened, I imported all the tables, forms, and reports from the other 2 databases so everything is in one Access file now, saved as 'Seed Journal.'

I have one report titled "Not Germinated - Flowers." This is the frustrating part. I opened the "Flower Seed Starting Journal" database that was separate and on it's own, and the following code/event builder works perfectly in opening the specific form (based on ID) when I click on the Seed Name in the report (which is what I want, in case I want to edit my notes for that one):

Private Sub Seed_Name_Click()
DoCmd.OpenForm "Flower Seed Journal", acNormal, , "id = " & Me.ID, acFormEdit
End Sub

However, when I go to the new database with all 3 previous databases in the same Access file, the code above does not work. When I go back to report view, nothing happens when I click on the seed name. No errors pop up regarding debugging. Just nothing. I am at a loss as to why it works in one place and not the other. Here is a screenshot of the Access Objects for reference. I would greatly appreciate any help.

Screenshot of Access Objects


Solution

  • I figured out the issue finally, in case anyone else has this problem. I had to go in under "Info" and mark it as trusted content. Once I did that, I was able to click the seed name in the report to take me to the form I had created for that specific seed type to view details should I need to.