Undefined function "FnElapsed" in Expression (1 Viewer)

omarrr128

Member
Local time
Today, 15:11
Joined
Feb 5, 2023
Messages
69
Hello,

I have a database which gives me the error "Undefined function "FnElapsed" in Expression" whenever i open the file from a new computer for the first time. It does not affect the performance of the database. I did not make the module which includes the expression but I have tried seeing where it originates from but to no avail.

I have looked at the Tools > references too and there is nothing that begins with "Missing".

If anyone could please have a look at the database and resolve this issue so that the error doesnt pop up i would be very grateful as I am very lost.
If the vba needs any other clean up please let me know

Thank you :)
 

Attachments

  • linked.accdb
    3.9 MB · Views: 78

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:11
Joined
Feb 28, 2001
Messages
27,187
The database you posted won't let me see anything except the VBA code. It appears to perhaps be locked down. I can't even see a full ribbon, which I would need to easily examine content. I.e. it APPEARS that your ribbon has been customized. Your Module1 defines fnElapsed as a Public Function so I don't know at the moment what is wrong. As locked down as this is, I have no interest in doing an autopsy. As a point for future reference, it would be nice if you post a database that we can easily examine in order to help you.

Also as a point of reference, it was not necessary to start a new thread. You expressed the same exact problem in


Duplicating threads like that tends to annoy some of us because it is like you are shopping around for answers and don't trust us to follow up.
 

omarrr128

Member
Local time
Today, 15:11
Joined
Feb 5, 2023
Messages
69
The database you posted won't let me see anything except the VBA code. It appears to perhaps be locked down. I can't even see a full ribbon, which I would need to easily examine content. I.e. it APPEARS that your ribbon has been customized. Your Module1 defines fnElapsed as a Public Function so I don't know at the moment what is wrong. As locked down as this is, I have no interest in doing an autopsy. As a point for future reference, it would be nice if you post a database that we can easily examine in order to help you.

Also as a point of reference, it was not necessary to start a new thread. You expressed the same exact problem in


Duplicating threads like that tends to annoy some of us because it is like you are shopping around for answers and don't trust us to follow up.

Ah sorry that is my bad. I relinked the backend to the frontend and made some other parts visible and opened it myself from a different computer to see if it worked okay but as it was on a trusted computer i think that's why I was mistaken.

I am not an active user with forums like these. I mostly use ones like reddit so I thought making a new post with the database attached would get views whereas posting it on the old one would not make it resurface. I forgot that any new comment will rise the post to the top. I apologise.

I will attach the frontend again with less security. Please let me know if it works
 

omarrr128

Member
Local time
Today, 15:11
Joined
Feb 5, 2023
Messages
69
please let me know if this is better. Its a bit hard for me to tell.
 

Attachments

  • linked.accdb
    3.5 MB · Views: 76

Gasman

Enthusiastic Amateur
Local time
Today, 15:11
Joined
Sep 21, 2011
Messages
14,306
This is what I get when I try to run the form?

1689749281738.png

Why are the forms greyed out? :(
1689749322016.png
 

omarrr128

Member
Local time
Today, 15:11
Joined
Feb 5, 2023
Messages
69
This is what I get when I try to run the form?

View attachment 108962
Why are the forms greyed out? :(
View attachment 108963
they are greyed as they are hidden but the option "display hidden items" is on. Clicking on them should still open them.

Thank you for the screenshot. That is very weird that i dont get that error.

Ill try to upload a better version tomorrow. This database is driving me crazy
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:11
Joined
Sep 21, 2011
Messages
14,306
Might well be due to my Access being so old, sorry.
 

adhoustonj

Member
Local time
Today, 10:11
Joined
Sep 23, 2022
Messages
150
Your database is setup to display frm_JobsList2 on open, and the forms record source contains the fnElapsed function.

Code:
SELECT tbl_jobsList.[Date and Time], tbl_jobsList.Priority, tbl_jobsList.[From Location], tbl_jobsList.[To Location], tbl_jobsList.[Nurse Notes], tbl_jobsList.[Assign Porter], tbl_jobsList.[Job Start], tbl_jobsList.[Job Complete], tbl_jobsList.Request, tbl_jobsList.[Via Location], tbl_jobsList.[Porter Notes], tbl_jobsList.[Job Finish], tbl_jobsList.[Booking Staff], tbl_jobsList.[Patient Name], fnElapsed([Job Start],[Job Finish],[Job Complete]) AS Elapsed, tbl_jobsList.Quantity
FROM tbl_jobsList
WHERE (((tbl_jobsList.[Job Complete])=No));
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:11
Joined
Sep 21, 2011
Messages
14,306
Your database is setup to display frm_JobsList2 on open, and the forms record source contains the fnElapsed function.

Code:
SELECT tbl_jobsList.[Date and Time], tbl_jobsList.Priority, tbl_jobsList.[From Location], tbl_jobsList.[To Location], tbl_jobsList.[Nurse Notes], tbl_jobsList.[Assign Porter], tbl_jobsList.[Job Start], tbl_jobsList.[Job Complete], tbl_jobsList.Request, tbl_jobsList.[Via Location], tbl_jobsList.[Porter Notes], tbl_jobsList.[Job Finish], tbl_jobsList.[Booking Staff], tbl_jobsList.[Patient Name], fnElapsed([Job Start],[Job Finish],[Job Complete]) AS Elapsed, tbl_jobsList.Quantity
FROM tbl_jobsList
WHERE (((tbl_jobsList.[Job Complete])=No));
Which is a Public function in a standard Module?
Code:
Public Function fnElapsed(ByVal start_time As Variant, ByVal end_time As Variant, ByVal job_is_finished As Boolean) As Variant
Dim Elapsed
fnElapsed = Null
If Not IsDate(start_time) Then
    Exit Function
End If
If job_is_finished Then
    Elapsed = end_time - start_time

Else
    Elapsed = Now() - start_time

End If
fnElapsed = Format$(Elapsed, "hh:nn")
End Function
 

moke123

AWF VIP
Local time
Today, 10:11
Joined
Jan 11, 2013
Messages
3,920
they are greyed as they are hidden but the option "display hidden items" is on. Clicking on them should still open them.

Thank you for the screenshot. That is very weird that i dont get that error.

Ill try to upload a better version tomorrow. This database is driving me crazy
I have to ask cause I've encountered the same issue in a few posts lately.

What is the purpose of hiding your forms from yourself while developing?

You also appear to have some serious problems with your data. Looking at your tables you have no primary or foreign keys.
You are also using calculated fields in your tables which is generally frowned upon. Eliminate spaces, reserved words and special characters in table/object names.

Suggest you do some research on database normalization.
 

omarrr128

Member
Local time
Today, 15:11
Joined
Feb 5, 2023
Messages
69
I have to ask cause I've encountered the same issue in a few posts lately.

What is the purpose of hiding your forms from yourself while developing?

You also appear to have some serious problems with your data. Looking at your tables you have no primary or foreign keys.
You are also using calculated fields in your tables which is generally frowned upon. Eliminate spaces, reserved words and special characters in table/object names.

Suggest you do some research on database normalization.
I work on the database whilst I'm at work on a shared computer so it's quicker to keep them invisible as I only work on the forms mostly.

Thank you for your advice. I did not create the database from scratch so I didn't teach myself much about those things. I will take a look at them.
 
Last edited:

omarrr128

Member
Local time
Today, 15:11
Joined
Feb 5, 2023
Messages
69
Your database is setup to display frm_JobsList2 on open, and the forms record source contains the fnElapsed function.

Code:
SELECT tbl_jobsList.[Date and Time], tbl_jobsList.Priority, tbl_jobsList.[From Location], tbl_jobsList.[To Location], tbl_jobsList.[Nurse Notes], tbl_jobsList.[Assign Porter], tbl_jobsList.[Job Start], tbl_jobsList.[Job Complete], tbl_jobsList.Request, tbl_jobsList.[Via Location], tbl_jobsList.[Porter Notes], tbl_jobsList.[Job Finish], tbl_jobsList.[Booking Staff], tbl_jobsList.[Patient Name], fnElapsed([Job Start],[Job Finish],[Job Complete]) AS Elapsed, tbl_jobsList.Quantity
FROM tbl_jobsList
WHERE (((tbl_jobsList.[Job Complete])=No));
Thank you very much. That seems to be the origin of the problem. It was driving me mad looking everywhere. Thank you :)
 

omarrr128

Member
Local time
Today, 15:11
Joined
Feb 5, 2023
Messages
69
Thank you very much. That seems to be the origin of the problem. It was driving me mad looking everywhere. Thank you :)
Do you know how I would fix this issue?

I thought I had fixed it but I was wrong and it still shows up.
 

moke123

AWF VIP
Local time
Today, 10:11
Joined
Jan 11, 2013
Messages
3,920
remove "fnElapsed([Job Start],[Job Finish],[Job Complete]) AS Elapsed" from your recordsource
 

omarrr128

Member
Local time
Today, 15:11
Joined
Feb 5, 2023
Messages
69
remove "fnElapsed([Job Start],[Job Finish],[Job Complete]) AS Elapsed" from your recordsource
I tried that and it makes things worse.

There is a module in the form (that I didn't make) which shows the Elapsed time once a button has been clicked.

When I remove the fnElapsed part from the recordsource like you suggested the timer says "#Name?" Instead of showing how many minutes Elapsed.

I tried selecting the control source again for the text box which displays the time but it also comes up with the same #Name? Error
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 15:11
Joined
Sep 21, 2011
Messages
14,306
You have that function in your DB though :( , so there is more going one here.
Try running it from the immediate window and see what happens.
 

omarrr128

Member
Local time
Today, 15:11
Joined
Feb 5, 2023
Messages
69
You have that function in your DB though :( , so there is more going one here.
Try running it from the immediate window and see what happens.
Sorry what do you mean from immediate window?
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:11
Joined
Sep 21, 2011
Messages
14,306
Key in Ctrl + G
That will open a window. You can enter commands in that window. Call that function from there.
You can also see the result of Debug.Print statements in that window.

See the link for debugging in my signature.
 

moke123

AWF VIP
Local time
Today, 10:11
Joined
Jan 11, 2013
Messages
3,920
You really need to address some structural issues.
 

Users who are viewing this thread

Top Bottom