Error with accde database - The expression you entered... (1 Viewer)

porkie

New member
Local time
Tomorrow, 10:32
Joined
Dec 27, 2012
Messages
9
I have a working database which runs fine in accdb mode.

But when i compile it and run the accde file I get the error "The expression you entered has a function name that XXDB nameXX cant' find."

The problem is that the autoexec macro cannot find the VBA public function that is called with runcode command.

The accde file is running in the same folder as the accdb. It is a split database, I am only working on the Front End

I have tried, amongst others:
- Creating a new vba module and copying all the functions across

- Renaming the target function

- I reckoned there was a corruption somewhere, so I created a blank database and imported all the form/code/etc across from the broken version, which imported fine. The accdb ran but the compiled version failed again

At my wits end, I have been working on this issue for a week, anyone with any ideas? :banghead::banghead:
 
Hi Bob, Thanks for the prompt reply.

There are 100 forms it is quite big and proprietary - my main issue with uploading. What are SCOPE issues, never heard of that.
 
Hi Bob,

read the article thanks, the target function is Public in a module.

The problem only occurs in the compiled db not the accdb version which works fine. Am I right in thinking that if the target function can be found in the uncompiled accdb version, then the scope issue shouldn't be a problem?
 
It isn't reaching the first line of the code. I put a msgbox as the first line and it didn't trigger.

The error is it cannot find the function, rather than it is failing inside the function
 
The autoexec macro just has:

runcode autoexecstartup(1)

and the function is here:

Public Function autoexecStartup(SC As Integer)
Dim booLinksOK As Boolean
Dim booLinksChanged As Boolean
Dim booCheckAppFolder As Boolean
Dim strCheckMode As String

strCheckMode = "quick"
Call jstCheckTableLinks(strCheckMode, booLinksChanged, booLinksOK, booCheckAppFolder)

If Not (booLinksOK) Then
MsgBox "Linking of database failed. Try restarting again"
DoCmd.Quit acPrompt
End If

intStartCode = DLookup("[Numeric_system]", "[tblSystem]", "[rec_id] = 1")
' MsgBox intStartCode '1=debug 0 = live
' strImageFilePath = DLookup("[Text_system]", "[tblSystem]", "[rec_id] = 2")
strAssignedCompany = DLookup("[Text_system]", "[tblSystem]", "[rec_id] = 3")
' MsgBox intStartCode & strImageFilePath & strAssignedCompany

DoCmd.OpenForm "91PasswordEntry", , , , acFormAdd

End Function
 
When the accde is run, I get the msgbox style error with
"The expression you entered has a function name that XXDB nameXX cant' find."

Click OK and get the attached macro call error.
 

Attachments

  • error message.jpg
    error message.jpg
    44.1 KB · Views: 470
If you could let me have an e-mail address that would be fine, i just don't want to post it all on the forum. The FE filesize is 4mb, I wont send the BE as the error happens way before that gets involved!

I just tried creating a new public function in a module, with just a msgbox in, and changed the autoexec runcode to target the new function.

Works fine in accdb format, but the compiled accde failed to find the new function with the same errors.

I am also now testing this on my laptop rather than my desktop, but with the same results.

Thanks for all your help on this. It just seems so weird.
 
Hi Bob,

Thanks very much for helping me and finding that. I fixed them and it works fine now.
 
I found the problem. I have sent you details via email. It had nothing to do with not being able to find the function, but it was that you have several control sources that are currently generating errors (circular reference, field for which a table doesn't exist, fields that were set but weren't quite the right name). Once those are fixed, it will work just fine.
Hi, thanks for this reply, it helped me too! I had the same problem and after deleting this and that, like unused code, it suddenly worked fine.
Can you say how you found the faulty parts? Is there a method for looking? What I did was pretty random... :\
 
The error was a control where I had changed the bound table but not reset the control data source.

The control had the little error triangle but I had missed it as several other controls had the triangle due to warnings like label not linked to a table.

I suggest you check and clear all the control warnings as a standard procedure.

The error didn't show up in a compile and the run error was not helpful in directing you to the problem.
 
Hi
I had same problem but I solved by removing empty rustiness. Its very annoying that accdb does not give error message but the accde does.

I would like to share the solution with community :)

In my case there were some empty sub-routines in VBA which were causing the problem. Like below.
"
Private Sub Form_Type_BeforeUpdate(Cancel As Integer)

End Sub

Private Sub Form_Load()

End Sub
"

When I removed them then I could make and run the accde successfully.

//Arshad
 
I am currently experiencing the same issue. After compiling the database I am receiving the exact same error.

Is there a way to get a list of control warnings? Or do I have to navigate through every form?
 
navigate through every form.

If you are using VBA, ensure you have Option Explicit at the top of every module (just below Option Compare Database) and compile your code - in VBA window select Debug>Compile.

That will find a lot of potential errors

You should also have proper error handling to make sure you have a clean way of handling any errors that might be generates such as file not found, form not open, divide by zero etc
 

Users who are viewing this thread

Back
Top Bottom