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

Field Values conditioned on Yes/No Box

wasseypurian
I have trying to validate the entry in another field say 'Amount' after user enters the value(Yes/No using check box) in the field 'Checkout'.

How to make sure that I prompt user to enter a non zero amount in the 'Amount' field value if he enters 'Yes' in 'Checkout' field and leave it zero if chooses 'No'.
Jun 19 '14 #1
2 1935
JenZzz
9
Could you be a bit more specific.
If you simply want to check the value in your textbox and if it's empty, prompt the user to either enter or leave it 0 I would try something like this
Expand|Select|Wrap|Line Numbers
  1. If "" & Me.Textbox = "" Then
  2.      answer = msgbox"Enter data?", vbYesNo
  3. End If
  4. If answer = vbYes Then
  5.     'let the user enter his value
  6. Else
  7.     me.textbox.value = 0
  8. End If
  9.  
Jun 19 '14 #2
twinnyfo
3,653 Expert Mod 2GB
I think you want to have this validation after the user checks the check box? If this is the case, then something along these lines:


Expand|Select|Wrap|Line Numbers
  1. Private Sub chkCheckBox_AfterUpdate()
  2.     If Me.chkCheckBox Then
  3.         If Me.txtAmount = 0 Then 'assuming default value here
  4.             MsgBox "You must enter an amount"
  5.             Me.chkCheckBox = False
  6.             Me.txtAmount.SetFocus
  7.         End If
  8.     Else
  9.         Me.txtAmount = 0
  10.     End If
  11. End Sub
Hoep this hepps!
Jun 19 '14 #3

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

Similar topics

2
by: Wishing I was skiing mom | last post by:
In form1, which is an item master maintenance screen, I have a button which launches form2. Form2 contains an item master datagrid. After the user double-clicks the desired item record in form2 I...
1
by: Megan | last post by:
I have 2 tables, CASE and ISSUE. My table, CASE, stores the issues pertaining to that particular case. The table, CASE, was designed with 2 fields, IssueID and IssueDesc. Right now, all of the...
1
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title:...
2
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title:...
0
by: rlueneberg | last post by:
I am having difficulty with preserving field values in a DetailsView control after clicking the insert button event. protected void DetailsView1_ItemInserted(object sender,...
5
by: mehere | last post by:
Please excuse me if I am posting in wrong NG. Can someone explain how I can use javascript (I am assuming this is the best way to do it) to add two field values together. I.e. field 1 plus field...
5
by: sklett | last post by:
I'm not real experienced with asp.net so this may be obvious. I've got a situation where some of my client side javascript is causing my posted form's controls to lose their values. In other...
9
ADezii
by: ADezii | last post by:
There are basically 4 Methods that you can use to access the values of Fields in Recordsets. For the purposes of this demonstration, I'll be using a Table called tblEmployees, a Field named , and a...
3
by: Bjorn Sagbakken | last post by:
What is the best way to read single field values from a dataset? The dataset is populated with a customer record, showing well in a gridview. But I also want to read the single field values, like...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...
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
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...

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.