473,545 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3267
On 22 Nov 2003 09:28:00 -0800, tc*****@merseym ail.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****@NOTdatac entricsolutions .com (Jim Allensworth) wrote in message news:<3f******* *******@netnews .comcast.net>.. .
On 22 Nov 2003 09:28:00 -0800, tc*****@merseym ail.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*****@merseym ail.com (Terry) wrote:
Ji****@NOTdata centricsolution s.com (Jim Allensworth) wrote in message news:<3f******* *******@netnews .comcast.net>.. .
On 22 Nov 2003 09:28:00 -0800, tc*****@merseym ail.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_Af terUpdate()
Me.PASS = Me.MARK >= 24
End Sub

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

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

- Jim

Nov 12 '05 #4
Ji****@NOTdatac entricsolutions .com (Jim Allensworth) wrote in message news:<3f******* ********@netnew s.comcast.net>. ..
On 22 Nov 2003 14:27:59 -0800, tc*****@merseym ail.com (Terry) wrote:
Ji****@NOTdata centricsolution s.com (Jim Allensworth) wrote in message news:<3f******* *******@netnews .comcast.net>.. .
On 22 Nov 2003 09:28:00 -0800, tc*****@merseym ail.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_Af terUpdate()
Me.PASS = Me.MARK >= 24
End Sub

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

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_AfterUpdat e()
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
4938
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 webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or...
2
3119
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 to it three variables: magnetic declination, compass degrees and declination direction (east or west). The idea is that a user will enter the...
16
11144
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 the Check Box, AfterUpdate, I have tried: IIf(>=24,True,False) Also: IIf(>=24,1,0) Also:
1
2545
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 database and issue, and I apologize for a bit lengthy. The coding is located in the Event Procedure on the "On Open" property of the {rptLetter}: ...
30
3356
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 commits it. How does the other user get the updated view without polling for changes? Is there some sort of callback mechanism that can be set up on...
7
3558
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 a mysqli connection and database and updates the database. The problem is that when the page is reloaded it does not show the updated information...
0
2358
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 scans the database to find out where to change it. Basic concept is form is populated from an object from mysql tables, user changes fields (usually...
3
3671
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 the current date, and what I am trying to accomplish is if this date changes, then the second field, Tomorrow, will automatically become equivalant to...
2
3135
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 i change something in php file using in ajax function.it not refreshed,means its shows the previous result it not get updated.i can't understand...
0
7653
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7803
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7749
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5965
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5322
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3444
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3439
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1871
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.