By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,475 Members | 1,929 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,475 IT Pros & Developers. It's quick & easy.

Module Code

P: 16
Thanks everyone for all your help so far with my project. I have one question, that I think you will find easy, but I am stumped.

I have a form with an unbound field that I have put the module =bd() in the properties control source. Based on the calculations in the module (which refer to values on the form), the text in the box will change accordingly. The module VB code is below:

Function BD()
Set Apspine = Forms![Scorecard-form].[Ap spine T Score]

If [Apspine] < -2.5 Then
BD = "Osteoperosis"

ElseIf [Apspine] > -1 < -2.5 Then
BD = "Osteopenia"

ElseIf [Apspine] >= -1 Then
BD = "Normal"

Else
BD = "Not Evaluated"

End If
End Function

Instead of the field saying Osteoperosis, Osteopenia, Normal or Not Evalutated, all it says is #Name? Does anyone have any ideas what I am missing? I would really appreciate the help.

Thanks!
Sep 19 '07 #1
Share this Question
Share on Google+
1 Reply


patjones
Expert 100+
P: 931
Thanks everyone for all your help so far with my project. I have one question, that I think you will find easy, but I am stumped.

I have a form with an unbound field that I have put the module =bd() in the properties control source. Based on the calculations in the module (which refer to values on the form), the text in the box will change accordingly. The module VB code is below:

Function BD()
Set Apspine = Forms![Scorecard-form].[Ap spine T Score]

If [Apspine] < -2.5 Then
BD = "Osteoperosis"

ElseIf [Apspine] > -1 < -2.5 Then
BD = "Osteopenia"

ElseIf [Apspine] >= -1 Then
BD = "Normal"

Else
BD = "Not Evaluated"

End If
End Function

Instead of the field saying Osteoperosis, Osteopenia, Normal or Not Evalutated, all it says is #Name? Does anyone have any ideas what I am missing? I would really appreciate the help.

Thanks!
Try leaving the text box properties control source empty and just assigning the text box a value right from the module.

For example, in the part of the module where all the calculations are done, at the end where the calculations are finished try

Expand|Select|Wrap|Line Numbers
  1. Me!txtBoxName=BD()
where "txtBoxName" is the name of your text box.
Sep 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.