0

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

Erik A
  • 31,639
  • 12
  • 42
  • 67
animalcroc
  • 283
  • 4
  • 13
  • It would be whatever "expression" is calling the function you commented out. It's impossible for us to answer this, or to trace where that expression is, because we can't see the code to which you're referring (and before you ask, no - there is no way to upload it, and even if there were it wouldn't be acceptable because all relevant content must be in the question itself). We don't know what `` means either, so it's difficult to offer suggestions regarding what you should investigate. – Ken White Dec 25 '14 at 04:08
  • "It would be whatever "expression" is calling the function you commented out."- That's what I'm trying to find. And what do you mean there is no way to upload it? I don't understand this, and the rest of your post. I'm sure there are lots of people here who no what means. According to my research, that's a standard access phrase that can appear in the stack trace. Thanks for your reply. – animalcroc Dec 25 '14 at 05:03
  • The *expression* calling the function is *the code that called the function*, which clearly we can't see. There's no way to upload it because SO does not have a site for uploading source. None of us know what `` means (it's a term you used in your question, specifically in the last code block - define ``, because that can mean anything - it may be a function imported from an unknown DLL or library). Consider "I have a group of letters. Google Translate says it's an ``. What does it mean?" - can you answer? – Ken White Dec 25 '14 at 05:17
  • is what the stack trace shows. I did not make that up. What do you mean SO does not allow anyone to upload source? We are allowed to upload code here, and we do it by indenting 4 spaces so that the code is in a grey box. – animalcroc Dec 25 '14 at 06:29
  • You can include code in your post, which is not the same as posting a link. You've not included the code. Formatting is not "uploading".Sorry - it's clear we're not on the same page here. I'll leave it to others to help you. – Ken White Dec 25 '14 at 06:37

1 Answers1

1

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!

animalcroc
  • 283
  • 4
  • 13