473,399 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Form as argument of function called from Textbox on same form

2
Hi,
I am using MSAccess 2002 Windows 2000 (stop laughing!)

I am trying to use a function to generate a string in a textbox on a form. I can't use expression builder because the expression is too long (it is HUGE). I have written a function in a module that works perfectly in the immediate window, however when I try to call the function from the textbox, I get an error.

Here is a small portion of the function (the rest will be similar and once I get this to work I know that I can get the rest to work):

Public Function HealthHazard(flapjacks As Form) As String
Dim strHealthHaz As String

With Form_SafetyPrecautionGeneration
If .Suspected.Value <> "N/A" Then
strHealthHaz = strHealthHaz & .Suspected.Value & " human: "
If .Carcinogen <> False Then
strHealthHaz = "Carcinogen"
End If
If .Teratogen = True Then
strHealthHaz = strHealthHaz & Chr(13) & Chr(10) & "Teratogen"
End If
End If
End With
HealthHazard = strHealthHaz
End Function[/indent]
In the textbox control source I am using:
=HealthHazard([Form_SafetyPrecautionGeneration])

It returns #Name? in view mode

I have tried it without the "Form_" and without the brackets and I also tried
=HealthHazard([Section0])

Again, it works perfectly using
?HealthHazard(Form_SafetyPrecautionGeneration)
in the immediate window.

Any help would be appreciated. Thanks!!
Feb 15 '08 #1
1 1454
lmj24
2
I figured it out...

In case anyone else is interested, the syntax in the expression builder is

=HealthHazard(Form!SafetyPrecautionGeneration)

Works perfectly....Aaaargh!
Feb 15 '08 #2

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

Similar topics

29
by: Mic | last post by:
Goal: delay execution of form submit Code (Javascript + JScript ASP): <% Response.Write("<OBJECT ID='IntraLaunch' STYLE='display : none' WIDTH=0 HEIGHT=0...
3
by: Andy | last post by:
Hi Using IE6. I have a textbox in a form. The form is called 'form1' and the textbox is called 'textfield1'. I have an onBlur event on the textbox to check its contents is an integer thus:...
4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
0
by: bob | last post by:
Hi all Currently porting an application to managed C++ Have managed to create working MDI form and child windows etc. Also added a callback from an unmanaged 'C' dll (ok that was strangely...
2
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
6
by: balancetotal | last post by:
Creating a running sum in continuous form in Access 2003 -------------------------------------------------------------------------------- Hello: I have three forms on my user-interface. ...
3
by: hugo | last post by:
Hi, I have a function that I call from form fields using the OnKeyUp function to replace special caracters. Once this function has been called, it does not set the focus on the form field where...
2
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi All! I am with a situation where I am not getting the right updating to the form's fields. The situation is the following one: I have one combobox and one textbox. I am using the...
16
by: John | last post by:
I am looking for VBA code that will work with Access 2003 to enable dragging and dropping a file/folder name from Windows XP Explorer into an Access form's text box. This is a common functionality...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.