Hi James.
Welcome to Bytes.com.
I suspect you were so confused by the problem in front of you that you let it take your concentration away from your question. When you post a question you will always have to consider it from the perspective of someone who doesn't already know what you're struggling with. They (We) will have to rely on two things :
- Their own experience & expertise.
- Whatever you include in your question about your problem or issue.
In this case we all have the first, but there is next to nothing of the second to work from (or on). The error message is great. More than we often find ourselves with. The code you have in your Standard Module is fundamental to the context though. Without that we are very much limited (In this case limited to almost nothing at all.) in what we can do to help.
I would guess, if your intention is to open another database from a Form, that you would want the code to be in the module associated with that Form, but with so little info available at this time I can't be sure. We can probably cover that later on when we know more.
I suspect your next reply should include :
- The code that you have in your module. At least all that's relevant to this task.)
- An explanation of what you're trying to do. Opening a database can be the description of three different things :
- Opening a database in the current session as the main database (CurrentDatabase in Access terms). This would necessarily close the current CurrentDatabase (which of course means the one the code is running from).
- Opening a new copy of Access and specifying a database it should open as it does so. This is a completely different Access session and doesn't otherwise affect the existing CurrentDatabase or running code.
- Opening another database within the same session as a simple database (as opposed to the CurrentDatabase). Access can handle multiple databases in a session but only ever one CurrentDatabase at a time.
Once we know what you are actually looking for I'm sure there will be many here willing to help. As I write this I see that 37 have already viewed it. Most of those will have been with a view to help if they can but were put off by the lack of sense in the question itself. Once you rectify that I would expect many to help.