I'm new to access and am working with a database someone else wrote.
I'm trying to understand the code by tracing it, but surprisingly I'm having trouble here.
There's a form, let's call it form 1, such that if you click it's "go" button it will execute a procedure. The first command in that procedure is:
DoCmd.OpenForm "Frm2", acNormal
When this line executes it goes to some module, "module X", where two functions are executed. These
functions are in a stand-alone module and I don't see how they are related to Frm2.
After these two functions are executed, control goes to Frm2, specifically this line in Frm2's code:
Form.Load
So, my question, as I alluded to earlier, is why are the two functions in module X called before
control is handed to Frm2?
When the first of the two mystery functions are being executed, I do a stack trace and I see this:
function1()
<non-basic code>
Frm1_Btn_click()
This doesn't tell me what's calling function1, and its throwing me off.
If I comment out function1, I get a run-time error 3085 "Undefined Function
function 1 in Expression". This begs the question, what "expression" is the error referring to?
I believe this is the missing link, but I can't find it.
Thanks for your help
I solved it. The issue was a dependency that was caused by the form having a record source linked to a query. The was due to this.
I'm glad I was able to solve this!
Related
About 18 months ago, I created an exception for a trigger which works fine. Now, when I have tried to create a new exception for a new trigger, it looks more like an error. So the trigger still compiles and the exception still halts the trigger, but it does not look professional. It says:
I would expect just:
But with the message "Supplier Required in Line Source Tab."
I guess my question wasn't clear enough and for this I apologise. With lots of exceptions which do nothing else than to inform the user there is an issue and what it is, then why not just create one exception and change the message each time? I believe that somehow an exception belongs to a particular trigger. If that is the case, how is this done?
How your application display errors is not directly related to how these errors are raised. ISC API Guide describe how to parse status vector and recognize gdscodes so you can extract exception message and show it ignoring the rest.
After Install shield, I create a application complete and I excute it,
But something like follow picture. I cant debug it, and I cant fint the error what happend.
Someone can tell me, what method to solve it...
1) Like function parameter no use?
Well, I find a rule.
When run the application, the OnCommand Function is early than OnInitDialog function,
the OnCommand will handle static, buttom, listcontrol, color etc.
but My initial variable is in OninitDialog,
So it will append this result.
The solution is declare a variable to avoid into the function, when complete the OninitDialog.
I have been working on something that checks an MySQL Database to check something - however the program stops responding because it is constantly checking the database. Is it possible to have it wait a few seconds to recheck the database? I have tried sleep() but it is giving a strange error:
A call to PInvoke function
'Game!WindowsApplication1.Form1::Sleep' has unbalanced the
stack. This is likely because the managed PInvoke signature
does not match the
unmanaged target signature. Check that the calling convention
and parameters of the
PInvoke signature match the target unmanaged signature.
I have been looking into this for quite a while and i am in a predicament. I do need the MySQL databases to be checked very often. I tried making a web browser refresh before checking it again - but it started to lag the application.
Code:
function updateit()
' SQL Code goes here, it succeeds.
updateit() ' Update it again.
return true
end
updateit()
Your code example shows a recursive function with no base case. The result of that is always a stack overflow (an uncatchable exception in .Net).
Don't call your updateit() function from within the function itself. Instead, just write a loop to call it over and over.
Try doing your checks from a separate thread. Try dragging a BackgroundWorker onto your form and putting your check in that to make your program more responsive. I've never seen that error before though. Is it System.Threading.Thread.Sleep() or something specific to VB?
Looking at your code it looks like you've got infinite recursion. That will cause a stackoverflow... try
while(true)
'SQL code
end
The problem that I am facing is primarily on Exception Handling! When an exception occurs I want to put that data in another log table with the error message. However, in DB2 I am not able to figure out a way to retrieve the corresponding error message for the raised SQLSTATE.
PS: I have a stored procedure for this migration and I am not using any other language to call it.
We could do this through SQLERRM in oracle; probably it should be a small thing, still for some strange reasons I have not been able to find it yet!
Hopefully you would have an idea on this, ;-). I just need a pointer on this.
Thanks,
Harveer Uppal
DB2 has an SQLERRM function too. All you need to to is capture all of the tokens from the error and feed them into the function for the equivalent message you'd get from the CLP.
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.sql.rtn.doc/doc/r0022027.html
You should be able to get in the front-end code using DB2Exception.Message property.
While I'm developing my MS Access application, I open it with shift click. When an Error occurs, that is not trapped (by ON ERROR ...), a message box pops up informing me about the error. This is a good thing.
When a user open my application, he does't shift click, and an appropriate Start Form opens. However, now untrapped Errors don't show up, the application behaves as if the user clicked the Stop Button on the message box. I don't want this behaviour.
Is there an option / property / variable that provides the same behaviour in the production code (preferably even when the application id converted to an mde) as in development, i.e. show a message box for every untrapped error? Or is it neccessary to trap errors in every single event routine and pop up a message box by program?
It turns out, this is a side effect of setting the AllowSpecialKeys property to False. This can be done programmatically, but I did it in the menu under Tools > StartUp.
Since this property allows the user to open the code editor, it kind of makes sense, but the relationship of the phenomen described to this option was puzzling for me.
Does this mean, that if I want to hide my code, I need to write all those error handlers? Or is there one central place (like a main method in Java) where I can invoke an error handler. Alternatively, could I allow specical keys and just protect the code with a keyword?
You can create your own error handler and add it to all procs, subs and functions. You have this very nice MZ Tools VBA add-on that allows you many thing such as adding line numbers to your code, "preprogramming" your error label, etc.
If you are smart enough, you'll be able to use this add-on to generate a standard "error management" code displaying things such as err.number, err.description, and the undocument erl value, which is the number of the line where the error occured (you must first have your lines numbered before being able to get this value).
EDIT: I just opened this question on a similar subject.
As alluded to, MZ-Tools 3.0 is a great tool to aid in quickly adding error handlers. Also remember that errors which occur in procedures without error handlers "bubble up" to the last-invoked On Error statement. (And if no statement exists you get the little gray debug box.) The net effect of this, is that you can do minimal error handling by simply adding error handlers only to those procedures which are Public (or Friend) or called by event. This will make sure you always have at least 1 "top level" error handler invoked. If you want to add special handling to your private procedures after that feel free. If not, when an error occurs in them they will "bubble up" to the top level error handler.