Modules not appearing as Object Types in the Navigation Pane.

LOUISBUHAGIAR54

Registered User.
Local time
Today, 08:56
Joined
Mar 14, 2010
Messages
157
I would like to write a Public Function in access 2007. I have written such before and they work well.

I am now working on this new database. I would like to make a calculation so that I could derive a value called eGFR from a patient's serum creatinine. This is a test of kidney function.

I am having the following problems.

a. Modules are not appearing in the Navigation Pane of the Access 2007. When I press 'Object Types' in the Navigation Pane I get all object types such as tables, queries, forms, reports, macros but not modules. I know there are modules as I have written lots of vba code. Can someone please explain what is wrong?

b. I have written the following code within this Function. The following is the code.


Public Function eGFR(creatinine, Gender, Age) As Single
If IsNull(Age) Or IsNull(creatinine) Then
eGFR = 0
Else
If Gender = "Male" Then
eGFR = 186 * ((creatinine / 88.4) ^ -1.154) * Age ^ -0.203
ElseIf Gender = "Female" Then
eGFR = 186 * (((creatinine / 88.4) ^ -1.154) * Age ^ -0.203) * 0.742
eGFR = Int(eGFR)
End If
End If
This code is working fine in another database, however when I try to upload a query in the current database that has this function in one of the fields, I get an error saying the the function eGFR does not exit.

I have inserted the function into one of the modules that I have managed to enter. Can someone please enlighten me with this problem ?

Do I need to deposit the code elsewhere? How do I access Modules from the Navigation Pane?

Many thanks for your thoughts.

LouisB
 
I know there are modules as I have written lots of vba code.

And you wrote all this VBA code where? In form or report class modules? Those do not appear in the navigation pane. If you don't currently have any standard modules in your app, you can add one from a code window with Insert/Module. Then put your function there.
 
In fact I have now inserted a module with INSERT/MODULE, placed my code there and Bingo it is working. Never really grasped the difference between class modules and the others, and why the former do not appear and the latter do appear in the navigation pane.

In any case I wish to thank you for your help. These forums are great. Solved many of my problems.

LOUIS
 

Users who are viewing this thread

Back
Top Bottom