473,287 Members | 1,581 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,287 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 17934
NeoPa
32,554 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,554 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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.