473,386 Members | 2,078 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,386 software developers and data experts.

Refresh a form from another database?

1234567890
Nov 27 '10 #1
10 4256
NeoPa
32,556 Expert Mod 16PB
Stephen Parker:
It is my belief that there should be something simple to allow (FileB) to refresh the data in the form of (FileA)
Not mine I'm afraid Stephen. Referring to FileB from FileA should be fine, but the reverse is not true as far as I'm aware.

Why are you not looking at doing a .Requery of your form in FileA from the form itself when it has completed its call to FileB? Is it because the processes in FileB are running asynchronously?
Nov 27 '10 #2
123456789.
Nov 28 '10 #3
ADezii
8,834 Expert 8TB
I haven't had a chance to research this Logic, but you may wish to try something like this in order to Refresh a Form in an External Database.
Expand|Select|Wrap|Line Numbers
  1. 'Modular Level
  2. Dim appAccess As Access.Application
Expand|Select|Wrap|Line Numbers
  1. Dim frm As Access.Form     'Will be a Reference to the Form in External Database
  2.  
  3. 'Create new Instance of Microsoft Access.
  4. Set appAccess = CreateObject("Access.Application")
  5.  
  6. 'Open Database in Microsoft Access window.
  7. appAccess.OpenCurrentDatabase "C:\Stuff\Copy of Northwind.mdb"
  8.  
  9. 'appAccess qualifier is critical in referring to the Form in External DB
  10. Set frm = appAccess.CurrentDb.Containers("Forms").Documents("Orders")
  11.  
  12. frm.Refresh
Nov 28 '10 #4
123456789.
Nov 28 '10 #5
ADezii
8,834 Expert 8TB
I assume that you already have an Object Variable pointing to the New Instance of the Application (Access), can't you just swap out and see what happens? Can you post the relevant code so that we can see exactly what is happening, and as to how we can possibly integrate a solution into it?
Nov 28 '10 #6
123456789.
Nov 28 '10 #7
NeoPa
32,556 Expert Mod 16PB
Stephen Parker:
Yes.
Yes? Is that a yes to my question "Is it because the processes in FileB are running asynchronously?"? I'll have to assume so although frankly, that is not a clear way to communicate.
Stephen Parker:
It sounds so strange for Microsoft to make the Access modules code/functions available via a Reference but not the modules code/functions behind the forms as these are also modules
Hold your horses. Who told you that was the case? And why do you bring it up here? It's irrelevant as you don't even have a reference to that database (at least that you've shared so far), even to access standard code modules.

Let's take a step back. Form and other object-based modules are accessible, just as the standard code modules are, you just need to know how and to understand that forms are a class, not the instance of the class as we are used to treating them as. If you want to know how to access the public methods of a form class then look at the class name in the VBA IDE that is shown for each module-enable class. Typically forms have their generally known name (EG. frmMain) with Form_ at the start, so Form_frmMain. Form methods may be accessed this way. To access a form method, or any code, of a database you have no access to though, is a whole different ball game.

A potential solution would be to try passing the calling form itself, as an Form object, to the called routine in the other database (FileB) as a parameter. That way, it may be possible to call a .Requery of the passed form object reference directly the process has completed.
Nov 28 '10 #8
NeoPa
32,556 Expert Mod 16PB
Stephen Parker:
As for posting relevant code there is no relevant code to post. All relevant information is contained in the initial post.
You have no code (seems unlikely)? Or you decide it's not relevant to post it even though you've been asked (seems pretty uncooperative)?

It seems to me your code would indeed be particularly relevant here. Presumably you ask us for help on the understanding we may know something you don't. I suggest using your existing understanding to decide what we need is not the best approach. Your original post is certainly not well enough explained, nor detailed enough, to help me tell you how to handle this, but from snippets you've dropped, I think I can, with an understanding of how your two database instances link together. You could explain it in text without the relevant code, but so far you haven't. It really would be easier if you took a more cooperative attitude and just posted the code as requested. I know we want to help you. I can't see why you wouldn't want us to.
Nov 28 '10 #9
NeoPa
32,556 Expert Mod 16PB
Something didn't feel right about this. Some of your posts seemed a bit unhelpful, but I reread your original post, and the PM you sent, and realised that didn't sound like you at all. I can only assume some confusion somewhere along the line.

Rereading the first post (which though it does a pretty good job of including the fundamental facts doesn't quite answer all the questions) I realised my first reply suffered from confusing some of the FileAs with FileBs. FileA doesn't have a reference to FileB, the one it somehow calls (more details of the practicalities of this would be helpful), but FileB is the one with the reference to FileA, the original file with the updated data.

The important question here and now then is :
What are you referring to when you say a Reference?

Access References are actually library references that give information as to what objects and procedures are available from that library. An Access database can be referenced as a library as it does contain code that can be called. With this you may be able to call the .Requery of the form required in FileA, from FileB, but only because the instance of a class, when dealing with form classes, typically use the same name as the class itself. This may be worth a try.

If what you mean by Reference is actually a Form parameter passed to whatever procedure you originally called, then this too can give access to the form's code. Even more easily in fact. That would be simply Call FileAFormObject.Requery.

This would certainly have been easier to deal with had the clues contained in the code been available to look through. Please be very careful in future before deciding something you've been asked for isn't relevant.
Nov 28 '10 #10
123456789.
Nov 29 '10 #11

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: exg001 | last post by:
Hey all! Here's what I want to do: I have database A.mdb and database B.mdb. They are both using SQL linked tables, and I am utilizing a username/password login reference the SQL tables. ...
3
by: Joanne | last post by:
I have searched through previous threads regarding this error. I went back through all my code to make sure I closed and set to nothing all open db's and rs's. However, I still have one computer...
1
by: colleen1980 | last post by:
I copy a form from another database into my database. I need help how to i link the table which is in another database with that form. Thank you.
0
by: Phil Stanton | last post by:
I am trying to view the design of tables and queries in another database. This is the code on a form, "ObjectName.Column(0))" is the name of a table or query selected from the other database. I...
1
by: MFayaz | last post by:
Hello! I have to refresh datagridview when database update , IS there any way to solution that my datagridview auto refresh when any user update database. Thanks in Advance
7
by: CF FAN | last post by:
need logic so when the page is refreshed that it returns to the location of the change, not to the top of the page. Currently, when the page is refreshed, it takes you back to the beginning of...
2
by: Michiel Rapati-Kekkonen | last post by:
hi, every now and then I want to compare a field in a local table to a field in a table in another database. but not by linking it permanently. what would be the simplest approach thanks...
2
by: LynneH | last post by:
I am trying to figure out how to open one database from another database form. I need to have a central database where I open various others and run macros.
1
by: kwokv616 | last post by:
Hello! I have some codes that will import a table fro text file, then fill in null cells with some appropriate values. It will become so big that I need to separate this table from the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.