LOUISBUHAGIAR54
Registered User.
- Local time
- Today, 02:01
- 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 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