473,597 Members | 2,177 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

strangest hanging problem with re-attaching functions...

ARC
I have some functions that will allow a user to attach to a different
back-end database. I added this functionality to the program Ribbon in a
custom Access 2007 app. I have 2 ways to attach to a different back end db.
One is through a browse function. So the ribbon button option calls a macro
that runs a procedure that allows the user to browse to the back-end db,
then re-attaches the tables.

So for the browse button, A macro is launched: StartProgram("O ther"). If
"Other" is the mode, I put up a browse dialogue in the StartProgram
function.

This works fine. All tables get properly re-attached, and the program
re-loads everything. Now for the problem.

I just added a new twist to the above where they can define their own
database locations into a table: tDatabaseLocati ons, the idea being that
they can switch to different databases at a single click, without browsing.
So, on program startup, I programatically add ribbon buttons for each db
that they define, and put an onAction call on the button (see proc below).
Each programmatic button I create is followed by a number. So when the
ribbon is built, it will have a series of buttons with button names such as
BtnOpenCustomDb 1, BtnOpenCustomDb 2, etc.. By finding the number at the end,
I know which db this relates to in their tDatabaseLocati ons entry.

The code below will show the correct db name, so the logic is working
(message box line that is commented out). The kicker is that it will get all
the way through all of the code in the proc called on the very last line:
Call StartProgram(db nm)

However, when stepping through the code, when control is returned to this
calling proc (after running the Call StartProgram(db nm) line), the program
just hangs. Since StartProgram uses many of the same variables, such as db,
rs, i, etc. I tried using different names in this proc, such as ddb, rrs,
ii, etc. All had no effect. I tried adding the DoEvents line, again no luck.
Lastly, I tried setting IRibbonControl to nothing and db to nothing, again
no affect.

So it will run all code in the StartProgram proc, but when it returns to the
proc below (WhichDbClicked ), the program hangs. It appears to be treating
the call as a dialog (where it won't continue on to the last line until
StartProgram is complete). I think if it would simply execute the exit sub
line, while StartProgram is doing it's thing, all would be well.

Any ideas why it would be hanging?


Sub WhichDbClicked( control As IRibbonControl)
On Error GoTo ErrRtn
'
Dim ddb As Database, rrs As Recordset, recno As Integer, ii As Integer, dbnm
As String
recno = Right(control.I D, 1)
Set ddb = CurrentDb()
Set rrs = ddb.OpenRecords et("tDatabaseLo cations", DB_OPEN_SNAPSHO T)
rrs.MoveFirst
ii = 1
Do Until ii = recno
ii = ii + 1
rrs.MoveNext
Loop
'MsgBox "Database Selected: " & rrs!DBInternalN ame
dbnm = rrs!DbLocation
rrs.Close
ddb.Close
Set ddb = Nothing
Set IRibbonControl = Nothing
DoEvents
Call StartProgram(db nm)
Exit Sub
'
'
ErrRtn:
MsgBox Err.Number & " - " & Err.Description & ", Function: WhichDbClicked" ,
vbInformation
Exit Sub
End Sub

--
Andy
Aug 30 '07 #1
1 1695
ARC
Ok, I figured this out, but for the life of me I can't figure the "why" of
it.

Instead of using the line: Call StartProgram(db nm) and passing the full
datapath: "C:\pc experts\develop \IQOFF2007\Data baseNorth.accdb "

I added these 2 lines:

TempVars("Which Db").Value = dbnm
Call StartProgram("C ustom")

Then in StartProgram, if the passing variable is "Custom", I set a variable
DataPath to TempVars!WhichD b, then did the reconnecting of tables.

And oddly enough, the code now works perfectly. So the short of it is that
it had something to do with passing a long path to the StartProgram
function. The line causing the hang would have evaluated to a call like
this:

Call StartProgram("C :\pc experts\develop \IQOFF2007\Data baseNorth.accdb ")
I wonder why that would be?
Aug 31 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6685
by: Harlan Messinger | last post by:
A publication style guide indicates that for a table heading like the following, Table 3. Wheat and rye harvest in European countries in years that end in 3 or 7 or when a new prime minister takes office. when the heading flows over more than one line, a hanging indent should be used, such that the remainder of the heading should be left-aligned, in this example, with "Wheat", leaving "Table 3. " standing off by itself on the left.
25
5011
by: Shannon Jacobs | last post by:
Maybe there is a simple trick here, and I'm not spotting it... Is there a guru of CSS hanging around here who can help out? The page in question has a multi-column table with a list of links in each column. Because links are added and deleted separately in each column, it would be exceedingly awkward to use a separate table row for each link. Therefore, within each column the links are separated by <br> tags. However, the automatic line...
0
1229
by: Onin Tayson | last post by:
Hi All, How can I make my RadioButtonList to have a hanging indent when the text wraps to the next line? Example: O This is the default behavior when the text wraps.
5
2466
by: David C. Allen | last post by:
I have a vb.net app that is controling excel 2000 thru the com interop interface. I have referenced the excel 9.0 library and have cut down the code in the problem subroutine to this: Dim objExcelApp As New Excel.Application objExcelApp.Quit() objExcelApp = Nothing The problem is excel is hanging in memory and has to be closed by the task
0
946
by: ourspt | last post by:
Hi, In our application (web application in ASP.NET/VB.NET with SQL Server database), we have a situation where it is hanging due to double post back. In other words, if I have a check box on a screen and when the user clicks on the check box, there is a post back event happening. While that is happening, all the controls on the screen are still active and if the user happens to click on some other control, then due to this 'double post...
6
8516
by: Adrian | last post by:
Hi there My VB Code looks something like that: ************************************************************** Dim oShellApplication = CreateObject("Shell.Application") Dim objWindow For Each objWindow In oShellApplication.Windows() 'do stupid things with IE Next objWindow
1
3063
by: =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?= | last post by:
Hello guys, I was wondering if anybody here had implemented a solution where Tables are aligned according to what the hanging indent tells us when there is a potential for the table overflowing in the right margin or out of the page. I did some research a while back and came to the conclusion at that time that it wasn't possible to have both (either we align on the hanging indent and if there is a potential for a table to be 6.75
5
2377
by: Stanimir Stamenkov | last post by:
I'm trying to style an icon "hanging" below the first line of a heading and I've found interesting difference between Mozilla and the other browsers I'm trying with - Safari 3.1.1, Opera 9.27 and IE 6: http://www.geocities.com/stanio/test/hanging-icon.html I've used negative 'text-indent' and with Mozilla the first line of text doesn't flow over the "hanging" icon, while with the other browsers I see what I want to achieve. Which is...
3
1678
by: Microsoft | last post by:
Hi I have a c# program that continually runs 24/7 and performs a variety of tasks based on a timer. There is one routine that hangs every Saturday morning without fail. If I restart the program throughout the week is still hangs. I can restart it immediatly after the hang and it runs fine until next Saturday. There is nothing different about Saturday that I can think of.
2
8317
by: kj | last post by:
Hi! I have a Pythonoob question. I have a script that hangs indefinitely at random times; the only thing to do at this point is to kill it. I'm looking for suggestions on how to troubleshoot and debug the problem. I'm not even sure of where exactly the script is hanging, though I suspect it is right around when it tries to read from a pipe
0
7885
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8272
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8381
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8031
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6687
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5428
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3923
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1233
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.