473,793 Members | 2,927 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MS Access: Using the IIf Function in a form

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([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
16 11170
"Terry" <tc*****@mersey mail.com> schrieb im Newsbeitrag
news:38******** *************** ***@posting.goo gle.com...
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([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?


Hi Terry,

Use the After Update Edvent of the TextBox to set PASS
Something like:

IIf ... Me.PASS=True

Viel Erfolg,
Michael
Nov 12 '05 #2
You need this for the update and a similar sub for OnCurrent of Form.
It's nothing to do with what you key into the checkbox. This should be
locked anyway

Private Sub MARK_AfterUpdat e()

If MARK >= Then
Pass = True
Else
Pass = False
End If

End Sub

Phil
"Terry" <tc*****@mersey mail.com> wrote in message
news:38******** *************** ***@posting.goo gle.com...
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([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 #3
I put the sub into Afterupdate Event in the Mark control box and
although I get no error messages....not hing happens.
I couldn't put the sub in the OnCurrent of the form as I don't know
how to do this...did try help but found it much too complex to
understand. Is there an easy explanation of how to do this?

Terry

"Phil Stanton" <ph**@stantonfa mily.co.uk> wrote in message news:<3f******* *************** *@mercury.nildr am.net>...
You need this for the update and a similar sub for OnCurrent of Form.
It's nothing to do with what you key into the checkbox. This should be
locked anyway

Private Sub MARK_AfterUpdat e()

If MARK >= Then
Pass = True
Else
Pass = False
End If

End Sub

Phil
"Terry" <tc*****@mersey mail.com> wrote in message
news:38******** *************** ***@posting.goo gle.com...
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([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 #4
What version of Access are you using

Phil
"Terry" <tc*****@mersey mail.com> wrote in message
news:38******** *************** ***@posting.goo gle.com...
I put the sub into Afterupdate Event in the Mark control box and
although I get no error messages....not hing happens.
I couldn't put the sub in the OnCurrent of the form as I don't know
how to do this...did try help but found it much too complex to
understand. Is there an easy explanation of how to do this?

Terry

"Phil Stanton" <ph**@stantonfa mily.co.uk> wrote in message

news:<3f******* *************** *@mercury.nildr am.net>...
You need this for the update and a similar sub for OnCurrent of Form.
It's nothing to do with what you key into the checkbox. This should be
locked anyway

Private Sub MARK_AfterUpdat e()

If MARK >= Then
Pass = True
Else
Pass = False
End If

End Sub

Phil
"Terry" <tc*****@mersey mail.com> wrote in message
news:38******** *************** ***@posting.goo gle.com...
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([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 #5
Phil Stanton previously wrote:
Private Sub MARK_AfterUpdat e()
If me.MARK >= XXXXX Then 'what?
me.Pass = True Else
me.Pass = False
End If

End Sub


Regards

Peter Russell
Nov 12 '05 #6
On Sun, 23 Nov 2003 15:26 +0000 (GMT Standard Time), ru***@127.0.0.1
(Peter Russell) wrote:
Phil Stanton previously wrote:
Private Sub MARK_AfterUpdat e()

If me.MARK >= XXXXX Then 'what?
me.Pass = True
Else
me.Pass = False
End If

End Sub

Or simply...
Private Sub MARK_AfterUpdat e()
Me.PASS = Me.MARK >= 24
End Sub

- Jim
Nov 12 '05 #7
Terry, I'm wondering if you tried what I suggested in your other post
on this subject. Perhaps my instructions were not sufficiently clear.

At any rate consider what *event* you want to trigger this checking of
the check box. Then apply the code there.

- Jim

On 22 Nov 2003 15:53:44 -0800, tc*****@merseym ail.com (Terry) wrote:
I put the sub into Afterupdate Event in the Mark control box and
although I get no error messages....not hing happens.
I couldn't put the sub in the OnCurrent of the form as I don't know
how to do this...did try help but found it much too complex to
understand. Is there an easy explanation of how to do this?

Terry

"Phil Stanton" <ph**@stantonfa mily.co.uk> wrote in message news:<3f******* *************** *@mercury.nildr am.net>...
You need this for the update and a similar sub for OnCurrent of Form.
It's nothing to do with what you key into the checkbox. This should be
locked anyway

Private Sub MARK_AfterUpdat e()

If MARK >= Then
Pass = True
Else
Pass = False
End If

End Sub

Phil
"Terry" <tc*****@mersey mail.com> wrote in message
news:38******** *************** ***@posting.goo gle.com...
> 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([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 #8
Nay, Lad

The event should be triggered after he puts the mark in. The check box
basically is a pass or fail.

Possibly the problem is that it is a textbox and the 24 is being regarded as
a string rather than a number.

So use instaed ow what I suggested

Private Sub MARK_AfterUpdat e()

If CSng(MARK) >= 24 Then ' This converts it to single number
with decimals
Pass = True
Else
Pass = False
End If

End Sub

If you have the form in Design View and click on the small square at the
top left of the form you should see the form's properties. If you can't, on
the top menubar, click View then Properties.
When you have the property box open, select the Events Tab. The top event is
On Current#
Key in [ yes a square bracket which the will become [Event Procedure]. At
the right end of the line are 3 dots which when you press will open up the
VBA module.
It will already say

Private Sub Form_Current()

End Sub

so key in or copy and paste

If CSng(MARK) >= 24 Then ' This converts it to single number
with decimals
Pass = True
Else
Pass = False
End If

between the Private "Sub Form_Current()" and "End Sub"

Do the same thing by clicking on your MARK box

Phil

"Jim Allensworth" <Ji****@NOTdata centricsolution s.com> wrote in message
news:3f******** *****@netnews.c omcast.net...
Terry, I'm wondering if you tried what I suggested in your other post
on this subject. Perhaps my instructions were not sufficiently clear.

At any rate consider what *event* you want to trigger this checking of
the check box. Then apply the code there.

- Jim

On 22 Nov 2003 15:53:44 -0800, tc*****@merseym ail.com (Terry) wrote:
I put the sub into Afterupdate Event in the Mark control box and
although I get no error messages....not hing happens.
I couldn't put the sub in the OnCurrent of the form as I don't know
how to do this...did try help but found it much too complex to
understand. Is there an easy explanation of how to do this?

Terry

"Phil Stanton" <ph**@stantonfa mily.co.uk> wrote in message news:<3f******* *************** *@mercury.nildr am.net>...
You need this for the update and a similar sub for OnCurrent of Form.
It's nothing to do with what you key into the checkbox. This should be
locked anyway

Private Sub MARK_AfterUpdat e()

If MARK >= Then
Pass = True
Else
Pass = False
End If

End Sub

Phil
"Terry" <tc*****@mersey mail.com> wrote in message
news:38******** *************** ***@posting.goo gle.com...
> 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([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 #9
On Sun, 23 Nov 2003 16:37:59 -0000, "Phil Stanton"
<ph**@stantonfa mily.co.uk> wrote:
Nay, Lad Lad? It's obvious you don't know me at all. ;-)

The event should be triggered after he puts the mark in. The check box
basically is a pass or fail.

Possibly the problem is that it is a textbox and the 24 is being regarded as
a string rather than a number. A textbox doesn't care what it holds: numbers, strings, calculations,
special characters, etc. That has no relevance to the issue.

So use instaed ow what I suggested

Private Sub MARK_AfterUpdat e()

If CSng(MARK) >= 24 Then ' This converts it to single number
with decimals
Pass = True
Else
Pass = False
End If

End Sub

You are too verbose - code wise. This will do what is needed

Me.PASS = Me.MARK >= 24

It could be placed in the forms On Current as well as the MARK After
Update. Although if it is a dataentry form then it is only needed for
the textbox.

- Jim
Nov 12 '05 #10

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

Similar topics

3
24038
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked tables in the database where the code resides. If we move the database with the data tables to a new directory, the links are no longer valid. I tried to update the links by changing the Connect property and refreshing: Set td = db.TableDefs(0)...
6
4756
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
7
4200
by: Ottar | last post by:
I've made a program sorting incomming mail in public folder. The function runs every minute by using the form.timer event. In Access XP it runs for weeks, no problem. Access 2003 runs the same code for 6 hours and stops. I've found the problem to be the Set MySession = CreateObject("MAPI.Session")
49
14362
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The application is relatively big: around 200 tables, 200 forms and sub-forms, 150 queries and 150 repports, 5GB of data (SQL Server 2000), 40 users. I'm wondering what are the disadvantages of using Access as front-end? Other that it's not...
42
11558
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
5
2692
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all that's come before. To take an extreme example, suppose you have been writing Visual Basic applications for years now. If you're like many developers, you will have built up a substantial inventory of code in that time. And if you've been following...
7
2633
by: thebarefootnation | last post by:
Hi, I have created an access db that I would like to secure. The database will exist on a shared drive and be used at a number of different locations hence the reason to secure the database. The users of the database also use other databases therefore I want to secure this database without using the wizard so it does not effect their other databases.
10
409
by: Les Desser | last post by:
In article <fcebdacd-2bd8-4d07-93a8-8b69d3452f3e@s50g2000hsb.googlegroups.com>, The Frog <Mr.Frog.to.you@googlemail.comMon, 14 Apr 2008 00:45:10 writes Thank you for that. It was very clear and I actually understand it!
16
11848
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 that most Windows programs have, so I'm suprised it's not easier to implement in Access/VBA. Through Google, I found two VB6 examples and one VBA example on the Access Web written by Dev Ashish. The VB6 examples used loops to keep checking...
7
2024
by: JDOMPer | last post by:
Don’t misunderstand me – I use AJAX, but I think there is a far simpler, elegant alternative that just uses Javascript, the DOM and Php ( hence - JDOMP) for data transfers, and is cross-browser without the need for work arounds. JDOMP works in recent versions of Explorer, Mozilla, Safari and Opera. Please note I will not deal with security issues which are always an issue whenever there is access to a database. You can simply change text on...
0
9670
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
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
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.