473,396 Members | 1,895 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,396 software developers and data experts.

How do I get the IIF Function to automatically update a Check Box in a form?

Hello,
I am designing a form from scratch and need to know how to get a Check
Box(PASS)to automatically update when the data in a Text Box (MARK),
in the same
form, is >=24.
Using the Event dialogue box for the Check Box, AfterUpdate, I have
tried:
IIf([MARK]>=24,True,False)
Also:
IIf([MARK]>=24,1,0)
Also:
IIf([MARK]>=24,"Yes","No")

Although I get no error messages, nothing seems to work.
Any suggestions?
Nov 12 '05 #1
4 3254
On 22 Nov 2003 09:28:00 -0800, tc*****@merseymail.com (Terry) wrote:
Hello,
I am designing a form from scratch and need to know how to get a Check
Box(PASS)to automatically update when the data in a Text Box (MARK),
in the same
form, is >=24.
Using the Event dialogue box for the Check Box, AfterUpdate, I have
tried:
IIf([MARK]>=24,True,False)
Also:
IIf([MARK]>=24,1,0)
Also:
IIf([MARK]>=24,"Yes","No")

Although I get no error messages, nothing seems to work.
Any suggestions?


Use the After Update event of the Text Box since that is what is being
updated. Try this...
Me.PASS = Me.MARK >= 24

- Jim
Nov 12 '05 #2
Ji****@NOTdatacentricsolutions.com (Jim Allensworth) wrote in message news:<3f**************@netnews.comcast.net>...
On 22 Nov 2003 09:28:00 -0800, tc*****@merseymail.com (Terry) wrote:
Hello,
I am designing a form from scratch and need to know how to get a Check
Box(PASS)to automatically update when the data in a Text Box (MARK),
in the same
form, is >=24.
Using the Event dialogue box for the Check Box, AfterUpdate, I have
tried:
IIf([MARK]>=24,True,False)
Also:
IIf([MARK]>=24,1,0)
Also:
IIf([MARK]>=24,"Yes","No")

Although I get no error messages, nothing seems to work.
Any suggestions?


Use the After Update event of the Text Box since that is what is being
updated. Try this...
Me.PASS = Me.MARK >= 24

- Jim


Tried thet Jim...got an error message saying "Can'tfind Macro .Me

Terry
Nov 12 '05 #3
On 22 Nov 2003 14:27:59 -0800, tc*****@merseymail.com (Terry) wrote:
Ji****@NOTdatacentricsolutions.com (Jim Allensworth) wrote in message news:<3f**************@netnews.comcast.net>...
On 22 Nov 2003 09:28:00 -0800, tc*****@merseymail.com (Terry) wrote:
>Hello,
>I am designing a form from scratch and need to know how to get a Check
>Box(PASS)to automatically update when the data in a Text Box (MARK),
>in the same
>form, is >=24.
>Using the Event dialogue box for the Check Box, AfterUpdate, I have
>tried:
>IIf([MARK]>=24,True,False)
>Also:
>IIf([MARK]>=24,1,0)
>Also:
>IIf([MARK]>=24,"Yes","No")
>
>Although I get no error messages, nothing seems to work.
>Any suggestions?


Use the After Update event of the Text Box since that is what is being
updated. Try this...
Me.PASS = Me.MARK >= 24

- Jim


Tried thet Jim...got an error message saying "Can'tfind Macro .Me

Terry


Terry it sounds like you copied that into the properties window
itself. This is VBA code, it belongs in the forms module.

Do this...

Open the textbox's properties go the the After Update event. Delete
what you had in there.

Press the elipsis button [...] to the right of the event. (If the
Builder window opens choose Code Builder)

This will open the form's module to the textboxes After Update event.
Paste the expression into it. It should look something like this

Private Sub txtMyTextBox_AfterUpdate()
Me.PASS = Me.MARK >= 24
End Sub

Note your textbox's name will be there is place of "txtMyTextBox".

If that doesn't work for you post back with your code.

- Jim

Nov 12 '05 #4
Ji****@NOTdatacentricsolutions.com (Jim Allensworth) wrote in message news:<3f***************@netnews.comcast.net>...
On 22 Nov 2003 14:27:59 -0800, tc*****@merseymail.com (Terry) wrote:
Ji****@NOTdatacentricsolutions.com (Jim Allensworth) wrote in message news:<3f**************@netnews.comcast.net>...
On 22 Nov 2003 09:28:00 -0800, tc*****@merseymail.com (Terry) wrote:

>Hello,
>I am designing a form from scratch and need to know how to get a Check
>Box(PASS)to automatically update when the data in a Text Box (MARK),
>in the same
>form, is >=24.
>Using the Event dialogue box for the Check Box, AfterUpdate, I have
>tried:
>IIf([MARK]>=24,True,False)
>Also:
>IIf([MARK]>=24,1,0)
>Also:
>IIf([MARK]>=24,"Yes","No")
>
>Although I get no error messages, nothing seems to work.
>Any suggestions?

Use the After Update event of the Text Box since that is what is being
updated. Try this...
Me.PASS = Me.MARK >= 24

- Jim


Tried thet Jim...got an error message saying "Can'tfind Macro .Me

Terry


Terry it sounds like you copied that into the properties window
itself. This is VBA code, it belongs in the forms module.

Do this...

Open the textbox's properties go the the After Update event. Delete
what you had in there.

Press the elipsis button [...] to the right of the event. (If the
Builder window opens choose Code Builder)

This will open the form's module to the textboxes After Update event.
Paste the expression into it. It should look something like this

Private Sub txtMyTextBox_AfterUpdate()
Me.PASS = Me.MARK >= 24
End Sub

Note your textbox's name will be there is place of "txtMyTextBox".

If that doesn't work for you post back with your code.

- Jim


Jim, Put the following code in as you said:

Private Sub Mark_AfterUpdate()
Me.Pass = Me.Mark >= 24
End Sub

Didn't get anything when I tried it out on the form, but when I closed
the form I got a runtime error '2113' "The value you have entered
isn't valid for this field" ....I clicked the Debug button. This
brought me back to the VBA code and the line:

Me.Pass = Me.Mark >= 24

was highlighted in yellow, with a yellow arrow to the left.

This has thrown me altogether as I couldn't find out how to actually
debug.

In the database I'm creating, I have made a relationship between the
"Student Details" table and the "Exam details" table so that I have a
single form with some fields from each table.

The Student Details Section Is at the top of the form, i.e ID, Name &
Location, and the Exam details are sort of embedded into this form in
the bottom half.

This means that a subform also exists for Exam details. I thought this
might have some baring on the result and placed the code in both the
form and the subform but the result is exactly the same.
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
2
by: Wilder | last post by:
I wrote a simple funtion to automatically compute corrected azimuths in several places in a database but am having trouble implementing it. I placed the function in a module and am trying to pass...
16
by: Terry | last post by:
Hello, I am designing a form and need to know how to get a Check Box(PASS)to automatically update when the data in a Text Box (MARK), in the same form, is >=24. Using the Event dialogue box for...
1
by: Curtis | last post by:
I am having a problem with the coding below that someone was trying to help me with in another website. I have been to several websites and hopefully here I can get it resolved. I inherited this...
30
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and...
7
by: Schmidty | last post by:
Okay...I have another 'newbie' question; I have a function that loads a page and the action is $_SERVER; In the form that is in a function(method?) within a class a variable is passed back to...
0
by: oh4real | last post by:
I recently developed a compact function to efficiently allow users to change info in a form (like account info, contact info, etc.) and then the function automatically identifies what's changed and...
3
by: Ciara9 | last post by:
I am having problems trying to update a field in a database using a field in a form. I currently have two fields, Today and Tomorrow in a table named Date. The Today field automatically defaults to...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...

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.