473,419 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Open Another Database from a Form

1 Bit
I have great difficulty getting to grips with Access VBA. I have copied the example given on this subject into a standard module (I assume it is a Function) and have tried several others. The code will not run, I get an 'Expected: end of Statement' error. It seems I have left out something basic and would be grateful for any advice. Regards
Nov 30 '21 #1
2 17951
NeoPa
32,556 Expert Mod 16PB
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 :
  1. Their own experience & expertise.
  2. 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 :
  1. The code that you have in your module. At least all that's relevant to this task.)
  2. An explanation of what you're trying to do. Opening a database can be the description of three different things :
    1. 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).
    2. 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.
    3. 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.
Nov 30 '21 #2
NeoPa
32,556 Expert Mod 16PB
Hi again James.

As you're clearly new I thought Before Posting (VBA or SQL) Code would help you avoid many of the early pitfalls new users stumble across.

In this case I would recommend going through an attempted compile first and either fixing any obvious errors or sharing them here so we can help with that.

This is the base level - to get your code syntax so that at least it's valid VBA code. If there are logic errors too then clearing away the syntax errors first will generally simplify the work to find and fix those.

Remember always, however eager we are to help (and that's generally pretty eager TBF), we can only do so when we understand what your problem is. Easy? Complicated? Generally unimportant. If you need help then the chances are that others may need the same type of help so many will be helped off the back of helping you.
Nov 30 '21 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: I Are Confused | last post by:
I am trying to open Database #2 while in Database #1 and delete a table that is in #2 so that I can copy a table from #1 into #2 - all through a function. My Database #2, as part of the start up,...
1
by: bailee220 | last post by:
I have included the following code to open an Access database form from within an exsisting Access database. But when I run the code, it appears that it opens the database because in windows...
1
by: bennett | last post by:
I'm trying to write an ASPX page that uses an OleDbDataAdapter to get data from a SQL Server database. When I test the connection, it returns success, and when I preview the data using the...
1
by: kevcar40 | last post by:
HI i have a database that runs autoexec on open the autoexec deletes the current tables and imports updates tables then open the form used for querying the tables this works fine however when a...
5
by: BD | last post by:
I am coding with C# in Visual Studio 2005 for a database application residing on remote MS SQL Server 2005. What I want to do is open the same form but from 2 different places and only one...
5
by: Ian | last post by:
I am trying to: 1. Open a form on the external database 2. Enter a value in a text box on that form I have 1 above working OK using module form “The Access Web”, the module looks like this: ...
1
by: billelev | last post by:
I am able to use the OpenCurrentDatabse method to open a new instance of an existing database and then open a form within that database. However, if the database I am interested in is already open,...
4
by: Martin Bentler | last post by:
I have a form that is locked for editing, adding or deleting. Through the use of a command button I open another form, that allows editing, plus allows the user to other areas of the database,...
5
by: Mai Le | last post by:
Hello Experts. Coul you please help me to fix my program. I created a login from with 2 levels. Admin an User. If Admin login will open A form and If User login will open B form I had table...
1
by: saqib attari | last post by:
hi i have problem in my vb project my project run in another computer with network but problem is that user and password form open but database form not open error show what i do ?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.